use of org.apache.catalina.tribes.Member in project tomcat by apache.
the class FarmWarDeployer method remove.
/**
* Remove an existing web application, attached to the specified context
* name. If this application is successfully removed, a ContainerEvent of
* type <code>REMOVE_EVENT</code> will be sent to all registered
* listeners, with the removed <code>Context</code> as an argument.
* Deletes the web application war file and/or directory if they exist in
* the Host's appBase.
*
* @param contextName
* The context name of the application to be removed
* @param undeploy
* boolean flag to remove web application from server
*
* @exception IllegalArgumentException
* if the specified context name is malformed
* @exception IllegalArgumentException
* if the specified context name does not identify a
* currently installed web application
* @exception IOException
* if an input/output error occurs during removal
*/
@Override
public void remove(String contextName, boolean undeploy) throws IOException {
if (getCluster().getMembers().length > 0) {
if (log.isInfoEnabled()) {
log.info(sm.getString("farmWarDeployer.removeStart", contextName));
}
Member localMember = getCluster().getLocalMember();
UndeployMessage msg = new UndeployMessage(localMember, System.currentTimeMillis(), "Undeploy:" + contextName + ":" + System.currentTimeMillis(), contextName);
if (log.isDebugEnabled()) {
log.debug(sm.getString("farmWarDeployer.removeTxMsg", contextName));
}
cluster.send(msg);
}
// remove locally
if (undeploy) {
try {
if (tryAddServiced(contextName)) {
try {
remove(contextName);
} finally {
removeServiced(contextName);
}
check(contextName);
} else {
log.error(sm.getString("farmWarDeployer.removeFailRemote", contextName));
}
} catch (Exception ex) {
log.error(sm.getString("farmWarDeployer.removeFailLocal", contextName), ex);
}
}
}
use of org.apache.catalina.tribes.Member in project tomcat by apache.
the class DeltaManager method findSessionMasterMember.
/**
* Find the master of the session state
* @return master member of sessions
*/
protected Member findSessionMasterMember() {
Member mbr = null;
Member[] mbrs = cluster.getMembers();
if (mbrs.length != 0) {
mbr = mbrs[0];
}
if (mbr == null && log.isWarnEnabled()) {
log.warn(sm.getString("deltaManager.noMasterMember", getName(), ""));
}
if (mbr != null && log.isDebugEnabled()) {
log.debug(sm.getString("deltaManager.foundMasterMember", getName(), mbr));
}
return mbr;
}
use of org.apache.catalina.tribes.Member in project tomcat70 by apache.
the class DeltaManager method findSessionMasterMember.
/**
* Find the master of the session state
* @return master member of sessions
*/
protected Member findSessionMasterMember() {
Member mbr = null;
Member[] mbrs = cluster.getMembers();
if (mbrs.length != 0)
mbr = mbrs[0];
if (mbr == null && log.isWarnEnabled())
log.warn(sm.getString("deltaManager.noMasterMember", getName(), ""));
if (mbr != null && log.isDebugEnabled())
log.warn(sm.getString("deltaManager.foundMasterMember", getName(), mbr));
return mbr;
}
use of org.apache.catalina.tribes.Member in project tomcat70 by apache.
the class FarmWarDeployer method remove.
/**
* Remove an existing web application, attached to the specified context
* name. If this application is successfully removed, a ContainerEvent of
* type <code>REMOVE_EVENT</code> will be sent to all registered
* listeners, with the removed <code>Context</code> as an argument.
* Deletes the web application war file and/or directory if they exist in
* the Host's appBase.
*
* @param contextName
* The context name of the application to be removed
* @param undeploy
* boolean flag to remove web application from server
*
* @exception IllegalArgumentException
* if the specified context name is malformed
* @exception IllegalArgumentException
* if the specified context name does not identify a
* currently installed web application
* @exception IOException
* if an input/output error occurs during removal
*/
@Override
public void remove(String contextName, boolean undeploy) throws IOException {
if (getCluster().getMembers().length > 0) {
if (log.isInfoEnabled())
log.info(sm.getString("farmWarDeployer.removeStart", contextName));
Member localMember = getCluster().getLocalMember();
UndeployMessage msg = new UndeployMessage(localMember, System.currentTimeMillis(), "Undeploy:" + contextName + ":" + System.currentTimeMillis(), contextName, undeploy);
if (log.isDebugEnabled())
log.debug(sm.getString("farmWarDeployer.removeTxMsg", contextName));
cluster.send(msg);
}
// remove locally
if (undeploy) {
try {
if (!isServiced(contextName)) {
addServiced(contextName);
try {
remove(contextName);
} finally {
removeServiced(contextName);
}
} else
log.error(sm.getString("farmWarDeployer.removeFailRemote", contextName));
} catch (Exception ex) {
log.error(sm.getString("farmWarDeployer.removeFailLocal", contextName), ex);
}
}
}
use of org.apache.catalina.tribes.Member in project tomcat70 by apache.
the class MessageDispatchInterceptor method sendAsyncData.
// run
protected LinkObject sendAsyncData(LinkObject link) {
ChannelMessage msg = link.data();
Member[] destination = link.getDestination();
try {
super.sendMessage(destination, msg, null);
try {
if (link.getHandler() != null)
link.getHandler().handleCompletion(new UniqueId(msg.getUniqueId()));
} catch (Exception ex) {
log.error("Unable to report back completed message.", ex);
}
} catch (Exception x) {
ChannelException cx = null;
if (x instanceof ChannelException)
cx = (ChannelException) x;
else
cx = new ChannelException(x);
if (log.isDebugEnabled())
log.debug("Error while processing async message.", x);
try {
if (link.getHandler() != null)
link.getHandler().handleError(cx, new UniqueId(msg.getUniqueId()));
} catch (Exception ex) {
log.error("Unable to report back error message.", ex);
}
} finally {
addAndGetCurrentSize(-msg.getMessage().getLength());
link = link.next();
}
// try
return link;
}
Aggregations