< prev index next >

src/java.corba/share/classes/com/sun/corba/se/impl/transport/CorbaConnectionCacheBase.java

Print this page




 113     public long numberOfBusyConnections()
 114     {
 115         long count = 0;
 116         synchronized (backingStore()) {
 117             Iterator connections = values().iterator();
 118             while (connections.hasNext()) {
 119                 if (((Connection)connections.next()).isBusy()) {
 120                     count++;
 121                 }
 122             }
 123         }
 124         return count;
 125     }
 126 
 127     /**
 128      * Discarding least recently used Connections that are not busy
 129      *
 130      * This method must be synchronized since one WorkerThread could
 131      * be reclaming connections inside the synchronized backingStore
 132      * block and a second WorkerThread (or a SelectorThread) could have
 133      * already executed the if (numberOfConnections <= .... ). As a
 134      * result the second thread would also attempt to reclaim connections.
 135      *
 136      * If connection reclamation becomes a performance issue, the connection
 137      * reclamation could make its own task and consequently executed in
 138      * a separate thread.
 139      * Currently, the accept & reclaim are done in the same thread, WorkerThread
 140      * by default. It could be changed such that the SelectorThread would do
 141      * it for SocketChannels and WorkerThreads for Sockets by updating the
 142      * ParserTable.
 143      */
 144     synchronized public boolean reclaim()
 145     {
 146         try {
 147             long numberOfConnections = numberOfConnections();
 148 
 149             if (orb.transportDebugFlag) {
 150                 dprint(".reclaim->: " + numberOfConnections
 151                         + " ("
 152                         + orb.getORBData().getHighWaterMark()
 153                         + "/"
 154                         + orb.getORBData().getLowWaterMark()
 155                         + "/"
 156                         + orb.getORBData().getNumberToReclaim()
 157                         + ")");
 158             }
 159 




 113     public long numberOfBusyConnections()
 114     {
 115         long count = 0;
 116         synchronized (backingStore()) {
 117             Iterator connections = values().iterator();
 118             while (connections.hasNext()) {
 119                 if (((Connection)connections.next()).isBusy()) {
 120                     count++;
 121                 }
 122             }
 123         }
 124         return count;
 125     }
 126 
 127     /**
 128      * Discarding least recently used Connections that are not busy
 129      *
 130      * This method must be synchronized since one WorkerThread could
 131      * be reclaming connections inside the synchronized backingStore
 132      * block and a second WorkerThread (or a SelectorThread) could have
 133      * already executed the if (numberOfConnections {@literal <=} .... ). As a
 134      * result the second thread would also attempt to reclaim connections.
 135      *
 136      * If connection reclamation becomes a performance issue, the connection
 137      * reclamation could make its own task and consequently executed in
 138      * a separate thread.
 139      * Currently, the accept {@literal &} reclaim are done in the same thread, WorkerThread
 140      * by default. It could be changed such that the SelectorThread would do
 141      * it for SocketChannels and WorkerThreads for Sockets by updating the
 142      * ParserTable.
 143      */
 144     synchronized public boolean reclaim()
 145     {
 146         try {
 147             long numberOfConnections = numberOfConnections();
 148 
 149             if (orb.transportDebugFlag) {
 150                 dprint(".reclaim->: " + numberOfConnections
 151                         + " ("
 152                         + orb.getORBData().getHighWaterMark()
 153                         + "/"
 154                         + orb.getORBData().getLowWaterMark()
 155                         + "/"
 156                         + orb.getORBData().getNumberToReclaim()
 157                         + ")");
 158             }
 159 


< prev index next >