use of com.sun.appserv.util.cache.BaseCache in project Payara by payara.
the class JavaEETransactionManagerSimplified method initProperties.
private void initProperties() {
// FIXME: this maxEntry should be a config
int maxEntries = 8192;
// FIXME: this loadFactor should be a config
float loadFactor = 0.75f;
// for now, let's get it from system prop
try {
String mEnlistDelists = System.getProperty("ALLOW_MULTIPLE_ENLISTS_DELISTS");
if ("true".equalsIgnoreCase(mEnlistDelists)) {
multipleEnlistDelists = true;
if (_logger.isLoggable(Level.FINE)) {
_logger.log(Level.FINE, "TM: multiple enlists, delists are enabled");
}
}
String maxEntriesValue = System.getProperty("JTA_RESOURCE_TABLE_MAX_ENTRIES");
if (maxEntriesValue != null) {
int temp = Integer.parseInt(maxEntriesValue);
if (temp > 0) {
maxEntries = temp;
}
}
String loadFactorValue = System.getProperty("JTA_RESOURCE_TABLE_DEFAULT_LOAD_FACTOR");
if (loadFactorValue != null) {
float f = Float.parseFloat(loadFactorValue);
if (f > 0) {
loadFactor = f;
}
}
} catch (Exception ex) {
// ignore
}
resourceTable = new BaseCache();
((BaseCache) resourceTable).init(maxEntries, loadFactor, null);
if (habitat != null) {
TransactionService txnService = habitat.getService(TransactionService.class, ServerEnvironment.DEFAULT_INSTANCE_NAME);
// running on the server side ?
if (txnService != null) {
transactionTimeout = Integer.parseInt(txnService.getTimeoutInSeconds());
// the delegates will do the rest if they support it
String v = txnService.getPropertyValue("purge-cancelled-transactions-after");
if (v != null && v.length() > 0) {
purgeCancelledTtransactions = Integer.parseInt(v);
}
TransactionServiceConfigListener listener = habitat.getService(TransactionServiceConfigListener.class);
listener.setTM(this);
}
ModuleMonitoringLevels levels = habitat.getService(ModuleMonitoringLevels.class);
// running on the server side ?
if (levels != null) {
String level = levels.getTransactionService();
if (!("OFF".equals(level))) {
monitoringEnabled = true;
}
}
}
// ENF OF BUG 4665539
if (_logger.isLoggable(Level.FINE)) {
_logger.log(Level.FINE, "TM: Tx Timeout = " + transactionTimeout);
}
// START IASRI 4705808 TTT004 -- monitor resource table stats
try {
// XXX TODO:
if (Boolean.getBoolean("MONITOR_JTA_RESOURCE_TABLE_STATISTICS")) {
registerStatisticMonitorTask();
}
StatsProviderManager.register(// element in domain.xml <monitoring-service>/<monitoring-level>
"transaction-service", // server.transaction-service node in asadmin get
PluginPoint.SERVER, // server.transaction-service node in asadmin get
"transaction-service", new TransactionServiceStatsProvider(this, _logger));
} catch (Exception ex) {
// ignore
}
monitor = new TransactionServiceProbeProvider();
}
use of com.sun.appserv.util.cache.BaseCache in project Payara by payara.
the class ActiveTxCache method registerMonitorableComponents.
@Override
protected void registerMonitorableComponents() {
super.registerMonitorableComponents();
if (readyStore != null) {
int confMaxCacheSize = cacheProp.maxCacheSize;
if (confMaxCacheSize <= 0) {
confMaxCacheSize = Integer.MAX_VALUE;
}
this.cacheStatsProvider = new EntityCacheStatsProvider((BaseCache) readyStore, confMaxCacheSize);
// registryMediator.registerProvider(cacheStatsProvider);
cacheProbeListener = new EjbCacheStatsProvider(cacheStatsProvider, getContainerId(), containerInfo.appName, containerInfo.modName, containerInfo.ejbName);
cacheProbeListener.register();
}
poolProbeListener = new EjbPoolStatsProvider(entityCtxPool, getContainerId(), containerInfo.appName, containerInfo.modName, containerInfo.ejbName);
poolProbeListener.register();
_logger.log(Level.FINE, "[Entity Container] registered monitorable");
}
use of com.sun.appserv.util.cache.BaseCache in project Payara by payara.
the class ActiveTxCache method createReadyStore.
protected void createReadyStore(int cacheSize, int numberOfVictimsToSelect, float loadFactor, long idleTimeout) throws Exception {
idleTimeout = (idleTimeout <= 0) ? -1 : idleTimeout;
if (cacheSize <= 0 && idleTimeout <= 0) {
readyStore = new BaseCache();
cacheSize = DEFAULT_CACHE_SIZE;
readyStore.init(cacheSize, loadFactor, null);
} else {
cacheSize = (cacheSize <= 0) ? DEFAULT_CACHE_SIZE : cacheSize;
LruCache lru = new LruCache(DEFAULT_CACHE_SIZE);
if (numberOfVictimsToSelect >= 0) {
loadFactor = (float) (1.0 - (1.0 * numberOfVictimsToSelect / cacheSize));
}
lru.init(cacheSize, idleTimeout, loadFactor, null);
readyStore = lru;
readyStore.addCacheListener(this);
}
if (idleTimeout > 0) {
idleBeansPassivator = setupIdleBeansPassivator(readyStore);
}
}
Aggregations