if (event.is(Deployment.APPLICATION_PREPARED) && isDas()) {
ExtendedDeploymentContext context = (ExtendedDeploymentContext)event.hook();
OpsParams opsparams = context.getCommandParameters(OpsParams.class);
DeployCommandParameters dcp = context.getCommandParameters(DeployCommandParameters.class);
ApplicationInfo appInfo = appRegistry.get(opsparams.name());
Application app = appInfo.getMetaData(Application.class);
if (app == null) {
// Not a Java EE application
return;
}
if (_logger.isLoggable(Level.FINE)) {
_logger.log( Level.FINE, "EjbDeployer in APPLICATION_PREPARED for origin: " + opsparams.origin +
", target: " + dcp.target + ", name: " + opsparams.name());
}
boolean createTimers = true;
if (!(opsparams.origin.isDeploy() || opsparams.origin.isCreateAppRef()) || env.getInstanceName().equals(dcp.target)) {
// Do real work only on deploy for a cluster or create-application-ref (the latter will
// check if it's the 1st ref being added or a subsequent one (timers with this unique id are present
// or not)
// Timers will be created by the BaseContainer if it's a single instance deploy
if (_logger.isLoggable(Level.FINE)) {
_logger.log( Level.FINE, "EjbDeployer ... will only set the timeout application flag if any");
}
// But is-timed-app needs to be set in AppInfo in any case
createTimers = false;
}
String target = dcp.target;
if (createTimers && dcp.isredeploy != null && dcp.isredeploy && DeploymentUtils.isDomainTarget(target)) {
List<String> targets = (List<String>)context.getTransientAppMetaData(DeploymentProperties.PREVIOUS_TARGETS, List.class);
for (String ref: targets) {
target = ref;
if (domain.getClusterNamed(target) != null) {
break; // prefer cluster target
}
}
}
if (_logger.isLoggable(Level.FINE)) {
_logger.log( Level.FINE, "EjbDeployer using target for event as " + target);
}
boolean isTimedApp = false;
for (EjbBundleDescriptorImpl ejbBundle : app.getBundleDescriptors(EjbBundleDescriptorImpl.class)) {
if (checkEjbBundleForTimers(ejbBundle, createTimers, target)) {
isTimedApp = true;
}
}
if (isTimedApp && (opsparams.origin.isDeploy() || opsparams.origin.isLoad())) {
// Mark application as a timeout application, so that the clean() call removes the timers.
appInfo.addTransientAppMetaData(IS_TIMEOUT_APP_PROP, Boolean.TRUE);
}
}
}