Changeset 61365 in vbox
- Timestamp:
- Jun 1, 2016 11:23:47 AM (9 years ago)
- svn:sync-xref-src-repo-rev:
- 107667
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/glue/glue-java.xsl
r61203 r61365 4543 4543 private final static ReferenceQueue<IUnknown> refQ = new ReferenceQueue<IUnknown>(); 4544 4544 4545 private final VboxPortType port;4546 4545 private final ConcurrentMap<String, ManagedObj> map = new ConcurrentHashMap<String, ManagedObj>(); 4547 4546 private final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); 4548 4547 private final ObjRefMgrCleanupThread objRefMgrCleanup; 4549 4548 4550 public ObjectRefManager(VboxPortType port) 4551 { 4552 this.port = port; 4549 public ObjectRefManager() 4550 { 4553 4551 this.objRefMgrCleanup = new ObjRefMgrCleanupThread(this, 100); 4554 4552 this.objRefMgrCleanup.start(); … … 4597 4595 public void registerObj(IUnknown obj) 4598 4596 { 4597 assert lock.getReadLockCount() > 0; 4599 4598 ManagedObjRef ref = new ManagedObjRef(obj); 4600 4599 … … 4607 4606 { 4608 4607 /* Create new. */ 4609 mgrobj = new ManagedObj(obj.getWrapped() );4608 mgrobj = new ManagedObj(obj.getWrapped(), obj.getRemoteWSPort()); 4610 4609 mgrobj.addObject(ref); 4611 4610 map.put(obj.getWrapped(), mgrobj); … … 4621 4620 public ManagedObj unregisterObj(ManagedObjRef objRef) 4622 4621 { 4623 assert lock.isWriteLockedByCurrentThread();4624 4625 4622 ManagedObj obj = this.map.get(objRef.objId); 4626 4623 … … 4635 4632 public void releaseRemoteObj(ManagedObj obj) 4636 4633 { 4634 assert lock.isWriteLockedByCurrentThread(); 4635 4637 4636 if (!obj.isReferenced()) 4638 4637 { 4639 4638 try 4640 4639 { 4641 this.port.iManagedObjectRefRelease(obj.objId);4640 obj.port.iManagedObjectRefRelease(obj.objId); 4642 4641 } 4643 4642 catch (InvalidObjectFaultMsg e) … … 4663 4662 { 4664 4663 private final String objId; 4664 private final VboxPortType port; 4665 4665 private final ConcurrentLinkedQueue<ManagedObjRef> refQ; 4666 4666 4667 ManagedObj(String objId )4667 ManagedObj(String objId, VboxPortType port) 4668 4668 { 4669 4669 this.objId = objId; 4670 this.port = port; 4670 4671 this.refQ = new ConcurrentLinkedQueue<ManagedObjRef>(); 4671 4672 } … … 4897 4898 { 4898 4899 private static PortPool pool = new PortPool(true); 4900 private static final ObjectRefManager objMgr = new ObjectRefManager(); 4899 4901 protected VboxPortType port; 4900 4902 4901 4903 private IVirtualBox vbox; 4902 private ObjectRefManager objMgr;4903 4904 4904 4905 private VirtualBoxManager() … … 4917 4918 { 4918 4919 this.port = pool.getPort(); 4919 this.objMgr = new ObjectRefManager(this.port);4920 4920 try 4921 4921 { … … 4938 4938 4939 4939 String handle = port.iWebsessionManagerLogon(username, passwd); 4940 this.vbox = new IVirtualBox(handle, this.objMgr, port); 4940 this.objMgr.preventObjRelease(); 4941 try 4942 { 4943 this.vbox = new IVirtualBox(handle, this.objMgr, port); 4944 } 4945 finally 4946 { 4947 this.objMgr.allowObjRelease(); 4948 } 4941 4949 } 4942 4950 catch (Throwable t) … … 4956 4964 { 4957 4965 this.port = pool.getPort(); 4958 this.objMgr = new ObjectRefManager(this.port);4959 4960 4966 try 4961 4967 { … … 4970 4976 put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, url); 4971 4977 String handle = port.iWebsessionManagerLogon(username, passwd); 4972 this.vbox = new IVirtualBox(handle, this.objMgr, port); 4978 this.objMgr.preventObjRelease(); 4979 try 4980 { 4981 this.vbox = new IVirtualBox(handle, this.objMgr, port); 4982 } 4983 finally 4984 { 4985 this.objMgr.allowObjRelease(); 4986 } 4973 4987 } 4974 4988 catch (Throwable t) … … 5031 5045 { 5032 5046 String handle = port.iWebsessionManagerGetSessionObject(this.vbox.getWrapped()); 5033 return new ISession(handle, this.objMgr, port); 5047 this.objMgr.preventObjRelease(); 5048 try 5049 { 5050 return new ISession(handle, this.objMgr, port); 5051 } 5052 finally 5053 { 5054 this.objMgr.allowObjRelease(); 5055 } 5034 5056 } 5035 5057 catch (InvalidObjectFaultMsg e)
Note:
See TracChangeset
for help on using the changeset viewer.