You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by dj...@apache.org on 2003/11/10 21:40:41 UTC
cvs commit: incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/service GeronimoMBeanEndpoint.java
djencks 2003/11/10 12:40:41
Modified: modules/kernel/src/java/org/apache/geronimo/kernel/service
GeronimoMBeanEndpoint.java
Log:
Make single-valued with not required and no peer work
Revision Changes Path
1.3 +18 -12 incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/service/GeronimoMBeanEndpoint.java
Index: GeronimoMBeanEndpoint.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/service/GeronimoMBeanEndpoint.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- GeronimoMBeanEndpoint.java 9 Nov 2003 20:01:12 -0000 1.2
+++ GeronimoMBeanEndpoint.java 10 Nov 2003 20:40:40 -0000 1.3
@@ -483,7 +483,7 @@
}
connections.clear();
connections = null;
- if(proxies != null) {
+ if (proxies != null) {
proxies.clear();
proxies = null;
}
@@ -509,7 +509,8 @@
proxies = new HashMap();
// Do we have enough connections?
- if (singleValued && connections.size() != 1) {
+ if ((singleValued && connections.size() > 1)
+ || (required && connections.size() == 0)) {
context.fail();
return;
}
@@ -523,12 +524,16 @@
// set the collection or instance proxy into the target
if (singleValued) {
- // we must block all other mbeans with matching name from starting
- dependency.addStartHolds(context.getObjectName(), peers);
+ if (connections.isEmpty()) {
+ setEndpointProxy(null);
+ } else {
+ // we must block all other mbeans with matching name from starting
+ dependency.addStartHolds(context.getObjectName(), peers);
- // set the connection into the target
- GeronimoMBeanEndpointConnection connection = (GeronimoMBeanEndpointConnection) connections.values().iterator().next();
- setEndpointProxy(connection.getProxy());
+ // set the connection into the target
+ GeronimoMBeanEndpointConnection connection = (GeronimoMBeanEndpointConnection) connections.values().iterator().next();
+ setEndpointProxy(connection.getProxy());
+ }
} else {
setEndpointProxy(Collections.unmodifiableCollection(proxies.values()));
}
@@ -539,7 +544,7 @@
}
public synchronized void doStop() {
- if(!running) {
+ if (!running) {
return;
}
@@ -678,7 +683,7 @@
connection.open();
proxies.put(connection.getObjectName(), connection.getProxy());
- if(singleValued) {
+ if (singleValued) {
setEndpointProxy(connection.getProxy());
}
}
@@ -722,9 +727,10 @@
log.warn("A problem occured while attemping to start", e);
}
}
- } if (running) {
+ }
+ if (running) {
// connection died... clean up
- if(singleValued) {
+ if (singleValued) {
setEndpointProxy(null);
}