513
513
synchronized VboxPortType getPort()
515
515
VboxPortType port = null;
516
518
for (VboxPortType cur: known.keySet())
518
if (known.get(cur) == 0)
520
int value = known.get(cur);
521
if ((value & 0x10000) == 0)
524
ttl = value & 0xffff;
535
539
port = svc.getVboxServicePort();
540
// reuse this object 0x10 times
537
known.put(port, new Integer(1));
544
known.put(port, new Integer(0x10000 | ttl));
583
601
public void connect(String url)
585
603
this.port = pool.getPort();
586
((BindingProvider)port).getRequestContext().
605
((BindingProvider)port).getRequestContext().
587
606
put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, url);
607
} catch (Throwable t) {
608
if (this.port != null)
609
pool.releasePort(this.port);
610
// we have to throw smth derived from RuntimeException
611
throw new WebServiceException(t);
590
615
public void connect(String url, Map<String, Object> requestContext, Map<String, Object> responseContext)
592
617
this.port = pool.getPort();
594
((BindingProvider)port).getRequestContext();
595
if (requestContext != null)
620
((BindingProvider)port).getRequestContext();
621
if (requestContext != null)
596
622
((BindingProvider)port).getRequestContext().putAll(requestContext);
598
if (responseContext != null)
624
if (responseContext != null)
599
625
((BindingProvider)port).getResponseContext().putAll(responseContext);
601
((BindingProvider)port).getRequestContext().
627
((BindingProvider)port).getRequestContext().
602
628
put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, url);
629
} catch (Throwable t) {
630
if (this.port != null)
631
pool.releasePort(port);
632
// we have to throw smth derived from RuntimeException
633
throw new WebServiceException(t);
606
638
public void disconnect(IVirtualBox refIVirtualBox)
608
logoff(refIVirtualBox);
609
pool.releasePort(port);
641
logoff(refIVirtualBox);
643
if (this.port != null) {
644
pool.releasePort(this.port);
612
650
public void cleanupUnused()