String name = from.getName() + "_" + to.getName(); String hashName = from.getName() + from.getContext() + "_" + to.getName() + to.getContext(); IBridge bridge = (IBridge) WeakMap.getValue(bridges.get(hashName)); if(bridge == null) {
final void freeHolders() { synchronized (refHolders) { for (Iterator i1 = refHolders.entrySet().iterator(); i1.hasNext();) { Map.Entry e = (Map.Entry) i1.next(); String oid = (String) e.getKey(); LinkedList l = (LinkedList) e.getValue(); for (Iterator i2 = l.iterator(); i2.hasNext();) { RefHolder rh = (RefHolder) i2.next(); for (boolean done = false; !done;) { done = rh.release(); _java_environment.revokeInterface(oid, rh.getType()); release(); } } } refHolders.clear(); } }
/** * Maps an object from destination environment to the source environment. * <p> * @return the object in the source environment * @param object the object to map * @param type the interface under which is to be mapped * @see com.sun.star.uno.IBridge#mapInterfaceFrom */ public Object mapInterfaceFrom(Object oId, Type type) { checkDisposed(); // TODO What happens if an exception is thrown after the call to // acquire, but before it is guaranteed that a pairing release will be // called eventually? acquire(); String oid = (String) oId; Object object = _java_environment.getRegisteredInterface(oid, type); if (object == null) { object = _java_environment.registerInterface( proxyFactory.create(oid, type), new String[] { oid }, type); // the proxy sends a release when finalized } else if (!hasRefHolder(oid, type)) { sendInternalRequest(oid, type, "release", null); } return object; }
int fid = msg.getMethod().getIndex(); if (fid == MethodDescription.ID_RELEASE) { _java_environment.revokeInterface(oid, type); remRefHolder(type, oid); if (msg.isSynchronous()) { obj = _java_environment.getRegisteredInterface( oid, type); if (obj == null
public Object mapInterfaceTo(Object object, Type type) { checkDisposed(); if (object == null) { return null; } else { String[] oid = new String[1]; object = _java_environment.registerInterface(object, oid, type); if (!proxyFactory.isProxy(object)) { // This branch must be taken iff object either is no proxy at // all or a proxy from some other bridge. There are objects // that behave like objects for this bridge but that are not // detected as such by proxyFactory.isProxy. The only known // case of such objects is com.sun.star.comp.beans.Wrapper, // which implements com.sun.star.lib.uno.Proxy and effectively // is a second proxy around a proxy that can be from this // bridge. For that case, there is no problem, however: Since // the proxies generated by ProxyFactory send each // queryInterface to the original object (i.e., they do not // short-circuit requests for a super-interface to themselves), // there will always be an appropriate ProxyFactory-proxy // registered at the _java_environment, so that the object // returned by _java_environment.registerInterface will never be // a com.sun.star.comp.beans.Wrapper. addRefHolder(object, type, oid[0]); } return oid[0]; } }
/** * Maps an object from destination environment to the source environment. * * @param oId the object to map. * @param type the interface under which is to be mapped. * @return the object in the source environment. * * @see com.sun.star.uno.IBridge#mapInterfaceFrom */ public Object mapInterfaceFrom(Object oId, Type type) { checkDisposed(); // TODO What happens if an exception is thrown after the call to // acquire, but before it is guaranteed that a pairing release will be // called eventually? acquire(); String oid = (String) oId; Object object = _java_environment.getRegisteredInterface(oid, type); if (object == null) { object = _java_environment.registerInterface( proxyFactory.create(oid, type), new String[] { oid }, type); // the proxy sends a release when finalized } else if (!hasRefHolder(oid, type)) { sendInternalRequest(oid, type, "release", null); } return object; }
int fid = msg.getMethod().getIndex(); if (fid == MethodDescription.ID_RELEASE) { _java_environment.revokeInterface(oid, type); remRefHolder(type, oid); if (msg.isSynchronous()) { obj = _java_environment.getRegisteredInterface( oid, type); if (obj == null
} else { String[] oid = new String[1]; object = _java_environment.registerInterface(object, oid, type); if (!proxyFactory.isProxy(object)) {
String name = from.getName() + "_" + to.getName(); String hashName = from.getName() + from.getContext() + "_" + to.getName() + to.getContext(); IBridge bridge = WeakMap.getValue(bridges.get(hashName)); if(bridge == null) {
final void freeHolders() { synchronized (refHolders) { for (Iterator<Map.Entry<String,LinkedList<RefHolder>>> i1 = refHolders.entrySet().iterator(); i1.hasNext();) { Map.Entry<String,LinkedList<RefHolder>> e = i1.next(); String oid = e.getKey(); LinkedList<RefHolder> l = e.getValue(); for (Iterator<RefHolder> i2 = l.iterator(); i2.hasNext();) { RefHolder rh = i2.next(); for (boolean done = false; !done;) { done = rh.release(); _java_environment.revokeInterface(oid, rh.getType()); release(); } } } refHolders.clear(); } }