You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fx-dev@ws.apache.org by ja...@apache.org on 2004/10/20 12:20:52 UTC
cvs commit: ws-fx/sandesha/src/org/apache/sandesha RMIntiator.java
jaliya 2004/10/20 03:20:52
Added: sandesha/src/org/apache/sandesha RMIntiator.java
Log:
This will isolate the initiation of the Sender and the RMInvoker. So depending on whether the
RMProvider is used in the server or the client, it will start the Sender and the RMInvoker
and returns the corresponding storage manager
Revision Changes Path
1.1 ws-fx/sandesha/src/org/apache/sandesha/RMIntiator.java
Index: RMIntiator.java
===================================================================
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.sandesha;
import org.apache.sandesha.client.ClientStorageManager;
import org.apache.sandesha.server.RMInvoker;
import org.apache.sandesha.server.Sender;
import org.apache.sandesha.server.ServerStorageManager;
/**
* @author Jaliya
* @auther Chamikara This class will act as the initiator for the Sender and the
* SimpleAxisServer,' In the client side, it will start the Sender and
* retruns ClientStorageManager. In the server side, it will start both
* the Sender and the RMInvoker and returns ServerStorageManager.
*/
public class RMIntiator {
private static boolean rmInvokerStarted = false;
private static boolean senderStarted = false;
public static IStorageManager init(boolean client) {
if (!senderStarted) {
System.out.println("INFO: Sender Thread started .....\n");
Sender sender = new Sender();
Thread thSender = new Thread(sender);
thSender.setDaemon(true);
senderStarted = true;
thSender.start();
}
if (client) {
return new ClientStorageManager();
} else {
if (!rmInvokerStarted) {
System.out.println("INFO: RMInvoker thread started ....\n");
RMInvoker rmInvoker = new RMInvoker();
Thread thInvoker = new Thread(rmInvoker);
thInvoker.setDaemon(true);
rmInvokerStarted = true;
thInvoker.start();
}
return new ServerStorageManager();
}
}
}