use of org.glassfish.hk2.classmodel.reflect.Types in project Payara by payara.
the class ApplicationLifecycle method getDeployableTypes.
@Override
public Types getDeployableTypes(DeploymentContext context) throws IOException {
synchronized (context) {
Types types = context.getTransientAppMetaData(Types.class.getName(), Types.class);
if (types != null) {
return types;
} else {
try {
// scan the jar and store the result in the deployment context.
ParsingContext parsingContext = new ParsingContext.Builder().logger(context.getLogger()).executorService(executorService).build();
Parser parser = new Parser(parsingContext);
ReadableArchiveScannerAdapter scannerAdapter = new ReadableArchiveScannerAdapter(parser, context.getSource());
parser.parse(scannerAdapter, null);
for (ReadableArchive externalLibArchive : getExternalLibraries(context)) {
ReadableArchiveScannerAdapter libAdapter = null;
try {
libAdapter = new ReadableArchiveScannerAdapter(parser, externalLibArchive);
parser.parse(libAdapter, null);
} finally {
if (libAdapter != null) {
libAdapter.close();
}
}
}
parser.awaitTermination();
scannerAdapter.close();
context.addTransientAppMetaData(Types.class.getName(), parsingContext.getTypes());
context.addTransientAppMetaData(Parser.class.getName(), parser);
return parsingContext.getTypes();
} catch (InterruptedException e) {
throw new IOException(e);
}
}
}
}
Aggregations