Changeset 22142 in vbox for trunk/src/VBox/Main/webservice
- Timestamp:
- Aug 10, 2009 4:17:02 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 50912
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/webservice/glue-jaxws.xsl
r21899 r22142 176 176 <xsl:param name="safearray" /> 177 177 <xsl:param name="forceelem" /> 178 178 179 179 <xsl:variable name="needarray" select="($safearray='yes') and not($forceelem='yes')" /> 180 180 … … 213 213 <xsl:param name="idltype"/> 214 214 <xsl:param name="safearray"/> 215 <xsl:variable name="isstruct" 215 <xsl:variable name="isstruct" 216 216 select="//interface[@name=$idltype]/@wsmap='struct'" /> 217 217 <xsl:choose> … … 281 281 <xsl:value-of select="concat('(', $value, ' != null) ? new ', $gluetype, '(', $value,', port) : null')" /> 282 282 </xsl:when> 283 <xsl:otherwise> 283 <xsl:otherwise> 284 284 <!-- if the MOR string is empty, that means NULL, so return NULL instead of an object then --> 285 285 <xsl:value-of select="concat('(', $value, '.length() > 0) ? new ', $gluetype, '(', $value,', port) : null')" /> … … 297 297 <xsl:template name="genStructWrapper"> 298 298 <xsl:param name="ifname" select="@name" /> 299 299 300 300 <xsl:value-of select="concat(' private ', $G_virtualBoxPackage,'.',$ifname, ' real; ')"/> 301 301 <xsl:value-of select="' private VboxPortType port; '"/> … … 306 306 <xsl:variable name="attrtype"><xsl:value-of select="@type" /></xsl:variable> 307 307 <xsl:variable name="attrreadonly"><xsl:value-of select="@readonly" /></xsl:variable> 308 <xsl:variable name="attrsafearray"><xsl:value-of select="@safearray" /></xsl:variable> 308 <xsl:variable name="attrsafearray"><xsl:value-of select="@safearray" /></xsl:variable> 309 309 <xsl:choose> 310 310 <xsl:when test="$attrreadonly='yes'"> 311 311 <xsl:value-of select="concat(' // read-only attribute ', $ifname, '::', $attrname, ' of type ', $attrtype, ' ')" /> 312 312 313 313 </xsl:when> 314 314 <xsl:otherwise> … … 369 369 370 370 </xsl:for-each> 371 371 372 372 </xsl:template> 373 373 … … 633 633 { 634 634 VboxPortType port = null; 635 int ttl = 0; 636 635 637 for (VboxPortType cur: known.keySet()) 636 638 { 637 if (known.get(cur) == 0) 639 int value = known.get(cur); 640 if ((value & 0x10000) == 0) 638 641 { 639 642 port = cur; 643 ttl = value & 0xffff; 640 644 break; 641 645 } … … 653 657 } 654 658 port = svc.getVboxServicePort(); 659 // reuse this object 0x10 times 660 ttl = 0x10; 655 661 } 656 known.put(port, new Integer(1)); 662 // mark as used 663 known.put(port, new Integer(0x10000 | ttl)); 657 664 return port; 658 665 } … … 660 667 synchronized void releasePort(VboxPortType port) 661 668 { 662 Integer val = 669 Integer val = known.get(port); 663 670 if (val == null || val == 0) 664 671 { … … 666 673 return; 667 674 } 668 known.put(port, val - 1); 675 676 int v = val; 677 int ttl = v & 0xffff; 678 // decrement TTL, and throw away port if used too much times 679 if (--ttl <= 0) 680 { 681 known.remove(port); 682 } 683 else 684 { 685 v = ttl; // set new TTL and clear busy bit 686 known.put(port, v); 687 } 669 688 } 670 689 } … … 703 722 { 704 723 this.port = pool.getPort(); 705 ((BindingProvider)port).getRequestContext(). 706 put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, url); 724 725 try { 726 ((BindingProvider)port).getRequestContext(). 727 put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, url); 728 } catch (Throwable t) { 729 if (this.port != null) 730 pool.releasePort(this.port); 731 // we have to throw smth derived from RuntimeException 732 throw new WebServiceException(t); 733 } 707 734 } 708 735 … … 711 738 this.port = pool.getPort(); 712 739 713 ((BindingProvider)port).getRequestContext(); 714 if (requestContext != null) 740 try { 741 ((BindingProvider)port).getRequestContext(); 742 if (requestContext != null) 715 743 ((BindingProvider)port).getRequestContext().putAll(requestContext); 716 744 717 if (responseContext != null)745 if (responseContext != null) 718 746 ((BindingProvider)port).getResponseContext().putAll(responseContext); 719 747 720 ((BindingProvider)port).getRequestContext().748 ((BindingProvider)port).getRequestContext(). 721 749 put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, url); 750 } catch (Throwable t) { 751 if (this.port != null) 752 pool.releasePort(port); 753 // we have to throw smth derived from RuntimeException 754 throw new WebServiceException(t); 755 } 722 756 } 723 757 … … 726 760 { 727 761 logoff(refIVirtualBox); 728 pool.releasePort( port);762 pool.releasePort(this.port); 729 763 } 730 764
Note:
See TracChangeset
for help on using the changeset viewer.