You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Trunk Manuel <ma...@swiss.com> on 2003/01/14 16:04:59 UTC

memory leak

Hi,

I use the code below to access an axis WebService. 
If I create one instance of these class and call the get method (more than once), all results (Flight[]) aren't garbage collected.
What am I doing wrong?

Thanks for your help, 
Manuel




public class Flights implements FlightsIF {

	private Call call;

	public Flights(ConfigFile conf) {
		this.conf = conf;
		try {
			String endpoint = "URL://Flights";
			Service service = new Service();
			call = (Call) service.createCall();
			call.setTargetEndpointAddress(new java.net.URL(endpoint));
			QName qn = new QName( "urn:Flights", "Flight" );
			BeanSerializerFactory bsf=new BeanSerializerFactory(Flight.class, qn);
			BeanDeserializerFactory bsdf=new BeanDeserializerFactory(Flight.class,qn);
			call.registerTypeMapping(Flight.class, qn, bsf, bsdf);
			call.setOperationName( new QName("Flights", "get"));
			call.setReturnType( XMLType.SOAP_ARRAY );
		} 
		catch (Exception e) {
			e.printStackTrace();
		}
		
	}

	public Flight[] get() {
		return this.get(this.defaultBase);
	}

	public synchronized Flight[] get(String boarding) {
		Flight[] flights=null;
		try {
			flights = (Flight[]) call.invoke(new Object[] {boarding.toUpperCase()});
		} 
		catch (RemoteException e) {
			e.printStackTrace();
		}
		return flights;
	}

}