Added thread local variable
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/accounting/accounting-dashboard-harvester-se-plugin@169136 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
f0f981d197
commit
3630de9582
|
@ -80,6 +80,23 @@ public class AccountingDataHarvesterPlugin extends Plugin<DataHarvestPluginDecla
|
||||||
return properties;
|
return properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static final InheritableThreadLocal<ContextAuthorization> contextAuthorization = new InheritableThreadLocal<ContextAuthorization>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected ContextAuthorization initialValue() {
|
||||||
|
try {
|
||||||
|
return new ContextAuthorization();
|
||||||
|
} catch(Exception e) {
|
||||||
|
throw new RuntimeException("Unable to instantiate ContextAuthorization");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
public static InheritableThreadLocal<ContextAuthorization> getContextAuthorization() {
|
||||||
|
return contextAuthorization;
|
||||||
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@Override
|
@Override
|
||||||
public void launch(Map<String,Object> inputs) throws Exception {
|
public void launch(Map<String,Object> inputs) throws Exception {
|
||||||
|
@ -138,7 +155,7 @@ public class AccountingDataHarvesterPlugin extends Plugin<DataHarvestPluginDecla
|
||||||
Properties properties = getConfigParameters();
|
Properties properties = getConfigParameters();
|
||||||
getProperties().set(properties);
|
getProperties().set(properties);
|
||||||
|
|
||||||
ContextAuthorization contextAuthorization = new ContextAuthorization();
|
ContextAuthorization contextAuthorization = AccountingDataHarvesterPlugin.contextAuthorization.get();
|
||||||
|
|
||||||
DatabaseManager dbaseManager = new DatabaseManager();
|
DatabaseManager dbaseManager = new DatabaseManager();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue