Skip to content
Permalink
Browse files
Cache outbound connections with reference counting.
  • Loading branch information
joe-chacko committed Oct 28, 2015
1 parent eab4a8d commit f580371d0268da98d776f118aa86c0d68b780a89
Showing 90 changed files with 2,591 additions and 1,075 deletions.
48 pom.xml
@@ -71,19 +71,20 @@
<packaging>pom</packaging>

<modules>
<module>yoko-core</module>
<module>yoko-osgi</module>
<module>yoko-spec-corba</module>
<module>yoko-rmi-spec</module>
<module>yoko-rmi-impl</module>
<module>yoko-util</module>
<module>yoko-rmi-impl</module>
<module>yoko-core</module>
</modules>

<dependencyManagement>
<dependencies>
<!-- Yoko modules -->
<dependency>
<groupId>org.apache.yoko</groupId>
<artifactId>yoko-core</artifactId>
<artifactId>yoko-osgi</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
@@ -93,19 +94,24 @@
</dependency>
<dependency>
<groupId>org.apache.yoko</groupId>
<artifactId>yoko-util</artifactId>
<artifactId>yoko-rmi-spec</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.yoko</groupId>
<artifactId>yoko-rmi-spec</artifactId>
<artifactId>yoko-util</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.yoko</groupId>
<artifactId>yoko-rmi-impl</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.yoko</groupId>
<artifactId>yoko-core</artifactId>
<version>${project.version}</version>
</dependency>
<!-- External dependencies -->
<dependency>
<groupId>junit</groupId>
@@ -117,16 +123,6 @@
<artifactId>org.apache.servicemix.bundles.bcel</artifactId>
<version>5.2_2</version>
</dependency>
<!--<dependency>-->
<!--<groupId>org.apache.maven</groupId>-->
<!--<artifactId>maven-plugin-api</artifactId>-->
<!--<version>${maven.version}</version>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>org.apache.maven</groupId>-->
<!--<artifactId>maven-project</artifactId>-->
<!--<version>${maven.version}</version>-->
<!--</dependency>-->
<dependency>
<groupId>ant</groupId>
<artifactId>ant</artifactId>
@@ -209,7 +205,6 @@
</compilerArguments>
</configuration>
</plugin>

</plugins>

<pluginManagement>
@@ -226,24 +221,6 @@
</dependency>
</dependencies>
</plugin>
<!--<plugin>-->
<!--<groupId>org.apache.maven.plugins</groupId>-->
<!--<artifactId>maven-surefire-plugin</artifactId>-->
<!--<configuration>-->
<!--<includes>-->
<!--<include>**/*Test.java</include>-->
<!--<include>**/*TestCase.java</include>-->
<!--</includes>-->
<!--<excludes>-->
<!--<exclude>**/*$*</exclude>-->
<!--</excludes>-->
<!--<reportFormat>brief</reportFormat>-->
<!--<useFile>false</useFile>-->
<!--<forkMode>once</forkMode>-->
<!--<childDelegation>false</childDelegation>-->
<!--<argLine>-ea</argLine>-->
<!--</configuration>-->
<!--</plugin>-->
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
@@ -272,9 +249,6 @@
<artifactId>maven-clover-plugin</artifactId>
<version>2.4</version>
</plugin>
<!--plugin>
<artifactId>maven-pmd-plugin</artifactId>
</plugin!-->
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
</plugin>
@@ -38,30 +38,34 @@
</dependency>
<dependency>
<groupId>org.apache.yoko</groupId>
<artifactId>yoko-spec-corba</artifactId>
<artifactId>yoko-osgi</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.yoko</groupId>
<artifactId>yoko-rmi-spec</artifactId>
<artifactId>yoko-spec-corba</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.yoko</groupId>
<artifactId>yoko-rmi-impl</artifactId>
<scope>test</scope>
<artifactId>yoko-rmi-spec</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.yoko</groupId>
<artifactId>yoko-util</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.yoko</groupId>
<artifactId>yoko-rmi-impl</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>

</dependencies>

<build>
@@ -102,7 +106,7 @@
</artifactItem>
<artifactItem>
<groupId>org.apache.yoko</groupId>
<artifactId>yoko-util</artifactId>
<artifactId>yoko-osgi</artifactId>
<type>jar</type>
<overWrite>true</overWrite>
<outputDirectory>${project.build.directory}/endorsed</outputDirectory>
@@ -127,7 +131,8 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>-Djava.endorsed.dirs=${basedir}/target/endorsed</argLine>
<argLine>-Xmx128m</argLine>
<argLine>-Djava.endorsed.dirs=${project.build.directory}/endorsed</argLine>
<includes>
<include>**/org/apache/yoko/*Test.java</include>
</includes>
@@ -1057,11 +1057,4 @@ public synchronized org.apache.yoko.orb.OB.DowncallStub _OB_getDowncallStub(
return downcallStub_;
}

public synchronized void _OB_closeConnection(boolean terminate) {
if (downcallStub_ == null) {
return;
}
downcallStub_._OB_closeConnection(terminate);
downcallStub_ = null;
}
}
@@ -19,8 +19,7 @@

import static org.apache.yoko.orb.OCI.GiopVersion.GIOP1_2;

import org.apache.yoko.orb.OCI.GiopVersion;
import org.apache.yoko.util.osgi.ProviderLocator;
import org.apache.yoko.osgi.ProviderLocator;

//
// ObjectImpl is the base class for proprietary stubs with full
@@ -53,7 +53,7 @@ public abstract class Client {
//
// Destroy the client
//
public abstract void destroy(boolean terminate);
public abstract void destroy();

//
// Increment usage (not mutex protected)
@@ -82,7 +82,7 @@ synchronized void destroy() {
//
// Destroy all clients
//
for (Client c : allClients_) c.destroy(false);
for (Client c : allClients_) c.destroy();

//
// Reset internal data
@@ -284,7 +284,7 @@ public synchronized Vector<ClientProfilePair> getClientProfilePairs(IOR ior, Pol
}

if (matched) {
newClient.destroy(false);
newClient.destroy();
continue;
}
}
@@ -372,7 +372,7 @@ public synchronized Vector<ClientProfilePair> getClientProfilePairs(IOR ior, Pol
return pairs;
}

public synchronized void releaseClient(Client client, boolean terminate) {
public synchronized void releaseClient(Client client) {
//
// The ORB destroys this object, so it's an initialization error
// if this operation is called after ORB destruction
@@ -400,7 +400,7 @@ public synchronized void releaseClient(Client client, boolean terminate) {
reusableClients_.remove(client);

if (allClients_.remove(client)) {
client.destroy(terminate);
client.destroy();
} else {
Assert._OB_assert("Release called on unknown client");
}
@@ -36,7 +36,7 @@ public CollocatedClient(CollocatedServer server, int concModel,
//
// Destroy the client
//
public void destroy(boolean terminate) {
public void destroy() {
// Nothing to do here
}

@@ -54,7 +54,6 @@ public DispatchRequest_impl(

public void invoke() {
poa_._OB_dispatch(oid_, upcall_);

upcall_ = null;
}
}
@@ -136,23 +136,23 @@ private synchronized Client getClientProfilePair(org.apache.yoko.orb.OCI.Profile
return clientProfilePair.client;
}

private void destroy(boolean terminate) {
private void destroy() {
//
// If the ORB has been destroyed then the clientManager can be nil
//
ClientManager clientManager = orbInstance_.getClientManager();

if (clientManager != null && clientProfilePairs_ != null) {
for (ClientProfilePair pair: clientProfilePairs_) {
clientManager.releaseClient(pair.client, terminate);
clientManager.releaseClient(pair.client);
}
}

clientProfilePairs_.removeAllElements();
}

protected void finalize() throws Throwable {
destroy(false);
destroy();

super.finalize();
}
@@ -355,7 +355,7 @@ public synchronized void handleFailureException(Downcall down, FailureException

for (ClientProfilePair pair : clientProfilePairs_) {
if (pair.client == client && pair.profile == profile) {
clientManager.releaseClient(pair.client, false);
clientManager.releaseClient(pair.client);
clientProfilePairs_.remove(pair);
break;
}
@@ -1026,10 +1026,6 @@ public boolean ami_callback_request(OutputStream out, ReplyHandler reply, org.ap
return delivered;
}

public void _OB_closeConnection(boolean terminate) {
destroy(terminate);
}

//
// Need to be able to access the ORB instance from a stub for AMI
// polling

0 comments on commit f580371

Please sign in to comment.