Subject | Re: [Firebird-Java] Closing connections, patches and other XA things. |
---|---|
Author | Andrew Goedhart |
Post date | 2007-03-17T12:20:30Z |
If you are worried about creating lots of garbage we could cache it when the gds is assigned to the GDSHelper in the constructor and then just return the same proxy. The proxy has no state so we should be able to share if we can share the underlying gds.
/**
* Create instance of this class.
*/
public GDSHelper(GDS gds, DatabaseParameterBuffer dpb, AbstractIscDbHandle dbHandle, GDSHelperErrorListener listener) {
this.gds = gds;
this.gdsProxy = new GDSProxy(gds);
....
....
}
...
...
...
/**
* Get Firebird API handler (sockets/native/embeded/etc)
*
* @return handler object for internal API calls
*/
public GDS getInternalAPIHandler() {
return this.gdsProxy;
}
This should allow proper encapsulation without much more overhead.
Andrew
/**
* Create instance of this class.
*/
public GDSHelper(GDS gds, DatabaseParameterBuffer dpb, AbstractIscDbHandle dbHandle, GDSHelperErrorListener listener) {
this.gds = gds;
this.gdsProxy = new GDSProxy(gds);
....
....
}
...
...
...
/**
* Get Firebird API handler (sockets/native/embeded/etc)
*
* @return handler object for internal API calls
*/
public GDS getInternalAPIHandler() {
return this.gdsProxy;
}
This should allow proper encapsulation without much more overhead.
Andrew