本文整理了Java中org.glassfish.api.event.Events
类的一些代码示例,展示了Events
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Events
类的具体详情如下:
包路径:org.glassfish.api.event.Events
类名称:Events
[英]Contract to register/unregister events listener. This implementation is not meant to be used for performance sensitive message delivery.
[中]注册/取消注册事件侦听器的合同。此实现并不用于性能敏感的消息传递。
代码示例来源:origin: org.glassfish.main.persistence/jpa-container
@Override
public void postConstruct() {
events.register(this);
}
代码示例来源:origin: org.glassfish.fighterfish/osgi-javaee-base
private void unregisterGlassFishShutdownHook() {
if (listener != null) {
events.unregister(listener);
}
}
代码示例来源:origin: org.glassfish.web/web-glue
/**
* Notifies any interested listeners that all ServletContextListeners
* of the web module represented by the given WebBundleDescriptor
* have been invoked at their contextInitialized method
*/
void afterServletContextInitializedEvent(WebBundleDescriptor wbd) {
events.send(new Event<WebBundleDescriptor>(
WebBundleDescriptor.AFTER_SERVLET_CONTEXT_INITIALIZED_EVENT, wbd),
false);
}
代码示例来源:origin: org.glassfish.main.core/kernel
events.send(new Event<DeploymentContext>(Deployment.DEPLOYMENT_START, context), false);
final ActionReport report = context.getActionReport();
final DeployCommandParameters commandParams = context.getCommandParameters(DeployCommandParameters.class);
context.getSource().addArchiveMetaData(DeploymentProperties.ALT_DD, commandParams.altdd);
context.createDeploymentClassLoader(clh, handler);
events.send(new Event<DeploymentContext>(Deployment.AFTER_DEPLOYMENT_CLASSLOADER_CREATION, context), false);
events.send(new Event<DeploymentContext>(Deployment.DEPLOYMENT_BEFORE_CLASSLOADER_CREATION, context), false);
context.createApplicationClassLoader(clh, handler);
events.send(new Event<DeploymentContext>(Deployment.AFTER_APPLICATION_CLASSLOADER_CREATION, context), false);
Thread.currentThread().setContextClassLoader(context.getClassLoader());
appInfo.setAppClassLoader(context.getClassLoader());
events.send(new Event<DeploymentContext>(Deployment.APPLICATION_PREPARED, context), false);
} finally {
if (report.getActionExitCode()==ActionReport.ExitCode.SUCCESS) {
events.send(new Event<ApplicationInfo>(Deployment.DEPLOYMENT_SUCCESS, appInfo));
long operationTime = Calendar.getInstance().getTimeInMillis() - operationStartTime;
if (appInfo != null) {
events.send(new Event<DeploymentContext>(Deployment.DEPLOYMENT_FAILURE, context));
代码示例来源:origin: fujitsu/launcher
source(initialContext.getSource()).archiveHandler(archiveHandler).build(initialContext);
if (tracing!=null) {
tracing.addMark(DeploymentTracing.Mark.CONTEXT_CREATED);
deploymentContext.addModuleMetaData(tracing);
deploymentContext.getAppProps().putAll(undeployProps);
events.unregister(this);
try {
archive.close();
代码示例来源:origin: fujitsu/launcher
@Override
public boolean preAuthorization(AdminCommandContext context) {
events.register(this);
initialContext.setArchiveHandler(archiveHandler);
initialContext.addModuleMetaData(tracing);
tracing.addMark(DeploymentTracing.Mark.INITIAL_CONTEXT_CREATED);
events.send(new Event<DeploymentContext>(Deployment.INITIAL_CONTEXT_CREATED, initialContext), false);
if (name==null) {
name = archiveHandler.getDefaultApplicationName(initialContext.getSource(), initialContext);
} else {
DeploymentUtils.validateApplicationName(name);
return true;
} catch (Exception ex) {
events.unregister(this);
if (initialContext != null && initialContext.getSource() != null) {
try {
代码示例来源:origin: org.glassfish.main.cluster/gms-adapter
events.register(glassfishEventListener);
gms.join();
} catch (GMSException e) {
events.unregister(glassfishEventListener);
throw e;
代码示例来源:origin: eclipse-ee4j/glassfish
public void load(ExtendedDeploymentContext context, ProgressTracker tracker) throws Exception {
Logger logger = context.getLogger();
context.setPhase(ExtendedDeploymentContext.Phase.LOAD);
DeploymentTracing tracing = context.getModuleMetaData(DeploymentTracing.class);
if (tracing!=null) {
tracing.addMark(DeploymentTracing.Mark.LOAD);
events.send(new Event<ModuleInfo>(Deployment.MODULE_LOADED, this), false);
代码示例来源:origin: org.glassfish.main.core/kernel
events.register(new org.glassfish.api.event.EventListener() {
public void event(Event event) {
if (event.is(EventTypes.SERVER_SHUTDOWN)) {
events.send(new Event<DeploymentContext>(Deployment.ALL_APPLICATIONS_PROCESSED, null));
代码示例来源:origin: fujitsu/launcher
public void undeploy(String appName, ExtendedDeploymentContext context) {
ActionReport report = context.getActionReport();
UndeployCommandParameters params = context.getCommandParameters(UndeployCommandParameters.class);
ApplicationInfo info = appRegistry.get(appName);
if (info==null) {
report.failure(context.getLogger(), "Application " + appName + " not registered", null);
events.send(new Event(Deployment.UNDEPLOYMENT_FAILURE, context));
return;
}
events.send(new Event(Deployment.UNDEPLOYMENT_START, info));
// for DAS target, the undeploy should unload the application
// as well
if (DeploymentUtils.isDASTarget(params.target)) {
unload(info, context);
}
if (report.getActionExitCode().equals(ActionReport.ExitCode.SUCCESS)) {
events.send(new Event(Deployment.UNDEPLOYMENT_SUCCESS, context));
deploymentLifecycleProbeProvider.applicationUndeployedEvent(appName, getApplicationType(info));
} else {
events.send(new Event(Deployment.UNDEPLOYMENT_FAILURE, context));
}
appRegistry.remove(appName);
}
代码示例来源:origin: org.glassfish.deployment/deployment-admin
deployment.getBuilder(logger, commandParams, report).source(archive).build();
Properties appProps = deploymentContext.getAppProps();
appProps.putAll(contextProps);
deploymentContext.setModulePropsMap(modulePropsMap);
versioningService.handleDisable(appName, target, deploymentContext.getActionReport());
} else {
events.send(new Event<DeploymentContext>(Deployment.APPLICATION_PREPARED, deploymentContext), false);
代码示例来源:origin: org.glassfish.main.core/kernel
public ApplicationInfo unload(ApplicationInfo info, ExtendedDeploymentContext context) {
ActionReport report = context.getActionReport();
if (info==null) {
report.failure(context.getLogger(), "Application not registered", null);
return null;
}
notifyLifecycleInterceptorsBefore(ExtendedDeploymentContext.Phase.STOP, context);
if (info.isLoaded()) {
info.stop(context, context.getLogger());
notifyLifecycleInterceptorsAfter(ExtendedDeploymentContext.Phase.STOP, context);
notifyLifecycleInterceptorsBefore(ExtendedDeploymentContext.Phase.UNLOAD, context);
info.unload(context);
notifyLifecycleInterceptorsAfter(ExtendedDeploymentContext.Phase.UNLOAD, context);
}
events.send(new Event<ApplicationInfo>(Deployment.APPLICATION_DISABLED, info), false);
try {
notifyLifecycleInterceptorsBefore(ExtendedDeploymentContext.Phase.CLEAN, context);
info.clean(context);
notifyLifecycleInterceptorsAfter(ExtendedDeploymentContext.Phase.CLEAN, context);
} catch(Exception e) {
report.failure(context.getLogger(), "Exception while cleaning", e);
return info;
}
return info;
}
代码示例来源:origin: eclipse-ee4j/glassfish
public void unload(ExtendedDeploymentContext context) {
Logger logger = context.getLogger();
if (!isLoaded) {
logger.fine("Application is already unloaded.");
return;
}
ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader();
try {
Thread.currentThread().setContextClassLoader(appClassLoader);
context.setClassLoader(appClassLoader);
super.unload(context);
for (ModuleInfo module : reversedModules) {
module.unload(getSubContext(module, context));
}
isLoaded = false;
if (events!=null) {
events.send(new Event<ApplicationInfo>(Deployment.APPLICATION_UNLOADED, this), false);
}
} finally {
Thread.currentThread().setContextClassLoader(currentClassLoader);
context.setClassLoader(null);
}
}
代码示例来源:origin: org.glassfish.deployment/deployment-admin
final Properties appProps = deploymentContext.getAppProps();
appProps.putAll(application.getDeployProperties());
deploymentContext.setModulePropsMap(
application.getModulePropertiesMap());
events.send(new Event<DeploymentContext>(Deployment.UNDEPLOYMENT_VALIDATION, deploymentContext), false);
deploymentContext.clean();
代码示例来源:origin: eclipse-ee4j/glassfish
public void stop(ExtendedDeploymentContext context, Logger logger) {
ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader();
try {
Thread.currentThread().setContextClassLoader(appClassLoader);
context.setClassLoader(appClassLoader);
super.stop(context, logger);
for (ModuleInfo module : reversedModules) {
module.stop(getSubContext(module, context), logger);
}
if (events!=null) {
events.send(new Event<ApplicationInfo>(Deployment.APPLICATION_STOPPED, this), false);
}
} finally {
Thread.currentThread().setContextClassLoader(currentClassLoader);
}
}
代码示例来源:origin: org.glassfish.common/internal-api
public void start(
ExtendedDeploymentContext context,
ProgressTracker tracker) throws Exception {
DeploymentTracing tracing = context.getModuleMetaData(DeploymentTracing.class);
if (tracing!=null) {
tracing.addMark(DeploymentTracing.Mark.START);
}
super.start(context, tracker);
// registers all deployed items.
for (ModuleInfo module : getModuleInfos()) {
if (tracing!=null) {
tracing.addModuleMark(DeploymentTracing.ModuleMark.START, module.getName());
}
module.start(getSubContext(module, context), tracker);
if (tracing!=null) {
tracing.addModuleMark(
DeploymentTracing.ModuleMark.STARTED, module.getName());
}
}
if (tracing!=null) {
tracing.addMark(DeploymentTracing.Mark.START_EVENTS);
}
if (events!=null) {
events.send(new Event<ApplicationInfo>(Deployment.APPLICATION_STARTED, this), false);
}
if (tracing!=null) {
tracing.addMark(DeploymentTracing.Mark.STARTED);
}
}
代码示例来源:origin: org.glassfish.main.core/kernel
if (appInfo != null) {
events.send(new Event<ApplicationInfo>(Deployment.APPLICATION_DISABLED, appInfo));
context.clean();
} catch (Exception e) {
代码示例来源:origin: fujitsu/launcher
events.send(new Event<DeploymentContext>(Deployment.DEPLOYMENT_START, context), false);
final ActionReport report = context.getActionReport();
final DeployCommandParameters commandParams = context.getCommandParameters(DeployCommandParameters.class);
context.getSource().addArchiveMetaData(DeploymentProperties.ALT_DD, commandParams.altdd);
context.createDeploymentClassLoader(clh, handler);
events.send(new Event<DeploymentContext>(Deployment.AFTER_DEPLOYMENT_CLASSLOADER_CREATION, context), false);
events.send(new Event<DeploymentContext>(Deployment.DEPLOYMENT_BEFORE_CLASSLOADER_CREATION, context), false);
context.createApplicationClassLoader(clh, handler);
events.send(new Event<DeploymentContext>(Deployment.AFTER_APPLICATION_CLASSLOADER_CREATION, context), false);
Thread.currentThread().setContextClassLoader(context.getClassLoader());
appInfo.setAppClassLoader(context.getClassLoader());
events.send(new Event<DeploymentContext>(Deployment.APPLICATION_PREPARED, context), false);
} finally {
if (report.getActionExitCode()==ActionReport.ExitCode.SUCCESS) {
events.send(new Event<ApplicationInfo>(Deployment.DEPLOYMENT_SUCCESS, appInfo));
long operationTime = Calendar.getInstance().getTimeInMillis() - operationStartTime;
if (appInfo != null) {
events.send(new Event<DeploymentContext>(Deployment.DEPLOYMENT_FAILURE, context));
throw new javax.enterprise.inject.spi.DeploymentException(report.getFailureCause());
代码示例来源:origin: org.glassfish.deployment/deployment-admin
public void execute(AdminCommandContext context) {
events.register(this);
initialContext.addModuleMetaData(tracing);
tracing.addMark(DeploymentTracing.Mark.INITIAL_CONTEXT_CREATED);
if (tracing!=null) {
tracing.addMark(DeploymentTracing.Mark.CONTEXT_CREATED);
deploymentContext.addModuleMetaData(tracing);
deploymentContext.getAppProps().putAll(undeployProps);
events.unregister(this);
代码示例来源:origin: org.glassfish.common/internal-api
public void load(ExtendedDeploymentContext context, ProgressTracker tracker) throws Exception {
Logger logger = context.getLogger();
context.setPhase(ExtendedDeploymentContext.Phase.LOAD);
DeploymentTracing tracing = context.getModuleMetaData(DeploymentTracing.class);
if (tracing!=null) {
tracing.addMark(DeploymentTracing.Mark.LOAD);
events.send(new Event<ModuleInfo>(Deployment.MODULE_LOADED, this), false);
内容来源于网络,如有侵权,请联系作者删除!