本文整理匯總了Java中com.sleepycat.je.EnvironmentConfig.getTransactional方法的典型用法代碼示例。如果您正苦於以下問題:Java EnvironmentConfig.getTransactional方法的具體用法?Java EnvironmentConfig.getTransactional怎麽用?Java EnvironmentConfig.getTransactional使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.sleepycat.je.EnvironmentConfig
的用法示例。
在下文中一共展示了EnvironmentConfig.getTransactional方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: CurrentTransaction
import com.sleepycat.je.EnvironmentConfig; //導入方法依賴的package包/類
private CurrentTransaction(Environment env) {
this.env = env;
try {
EnvironmentConfig config = env.getConfig();
txnMode = config.getTransactional();
lockingMode = DbCompat.getInitializeLocking(config);
if (txnMode || lockingMode) {
writeLockMode = LockMode.RMW;
} else {
writeLockMode = LockMode.DEFAULT;
}
cdbMode = DbCompat.getInitializeCDB(config);
if (cdbMode) {
localCdbCursors = new ThreadLocal();
}
} catch (DatabaseException e) {
throw new RuntimeExceptionWrapper(e);
}
}
示例2: CurrentTransaction
import com.sleepycat.je.EnvironmentConfig; //導入方法依賴的package包/類
private CurrentTransaction(Environment env) {
envRef = new WeakReference<Environment>(env);
try {
EnvironmentConfig config = env.getConfig();
txnMode = config.getTransactional();
lockingMode = DbCompat.getInitializeLocking(config);
if (txnMode || lockingMode) {
writeLockMode = LockMode.RMW;
} else {
writeLockMode = LockMode.DEFAULT;
}
cdbMode = DbCompat.getInitializeCDB(config);
if (cdbMode) {
localCdbCursors = new ThreadLocal();
}
} catch (DatabaseException e) {
throw RuntimeExceptionWrapper.wrapIfNeeded(e);
}
}
示例3: getOperationList
import com.sleepycat.je.EnvironmentConfig; //導入方法依賴的package包/類
/**
* Get mbean operation metadata for this environment.
*
* @param targetEnv The target JE environment. May be null if the
* environment is not open.
* @return List of MBeanOperationInfo describing available operations.
*/
public List getOperationList(Environment targetEnv) {
setNeedReset(false);
List operationList = new ArrayList();
if (targetEnv != null) {
/*
* These operations are only available if the environment is
* open.
*/
operationList.add(OP_CLEAN_INFO);
operationList.add(OP_EVICT_INFO);
operationList.add(OP_ENV_STAT_INFO);
operationList.add(OP_LOCK_STAT_INFO);
operationList.add(OP_DB_NAMES_INFO);
operationList.add(OP_DB_STAT_INFO);
/* Add checkpoint only for transactional environments. */
boolean isTransactional = false;
try {
EnvironmentConfig config = targetEnv.getConfig();
isTransactional = config.getTransactional();
} catch (DatabaseException e) {
/* Don't make any operations available. */
return new ArrayList();
}
if (isTransactional) {
operationList.add(OP_CHECKPOINT_INFO);
operationList.add(OP_TXN_STAT_INFO);
} else {
operationList.add(OP_SYNC_INFO);
}
}
return operationList;
}
示例4: getOperationList
import com.sleepycat.je.EnvironmentConfig; //導入方法依賴的package包/類
/**
* Get mbean operation metadata for this environment.
*
* @param targetEnv The target JE environment. May be null if the
* environment is not open.
* @return List of MBeanOperationInfo describing available operations.
*/
public List getOperationList(Environment targetEnv) {
setNeedReset(false);
List operationList = new ArrayList();
if (targetEnv != null) {
/*
* These operations are only available if the environment is
* open.
*/
operationList.add(OP_CLEAN_INFO);
operationList.add(OP_EVICT_INFO);
operationList.add(OP_ENV_STAT_INFO);
operationList.add(OP_LOCK_STAT_INFO);
operationList.add(OP_DB_NAMES_INFO);
operationList.add(OP_DB_STAT_INFO);
/* Add checkpoint only for transactional environments. */
boolean isTransactional = false;
try {
EnvironmentConfig config = targetEnv.getConfig();
isTransactional = config.getTransactional();
} catch (DatabaseException e) {
/* Don't make any operations available. */
return new ArrayList();
}
if (isTransactional) {
operationList.add(OP_CHECKPOINT_INFO);
operationList.add(OP_TXN_STAT_INFO);
} else {
operationList.add(OP_SYNC_INFO);
}
}
return operationList;
}
示例5: getOperationList
import com.sleepycat.je.EnvironmentConfig; //導入方法依賴的package包/類
/**
* Get mbean operation metadata for this environment.
*
* @param targetEnv The target JE environment. May be null if the
* environment is not open.
* @return List of MBeanOperationInfo describing available operations.
*/
public List<MBeanOperationInfo> getOperationList(Environment targetEnv) {
setNeedReset(false);
List<MBeanOperationInfo> operationList =
new ArrayList<MBeanOperationInfo>();
if (targetEnv != null) {
/*
* These operations are only available if the environment is open.
*/
operationList.add(OP_CLEAN_INFO);
operationList.add(OP_EVICT_INFO);
operationList.add(OP_ENV_STAT_INFO);
operationList.add(OP_DB_NAMES_INFO);
operationList.add(OP_DB_STAT_INFO);
/* Add checkpoint only for transactional environments. */
boolean isTransactional = false;
try {
EnvironmentConfig config = targetEnv.getConfig();
isTransactional = config.getTransactional();
} catch (DatabaseException e) {
/* Don't make any operations available. */
return new ArrayList<MBeanOperationInfo>();
}
if (isTransactional) {
operationList.add(OP_CHECKPOINT_INFO);
operationList.add(OP_TXN_STAT_INFO);
} else {
operationList.add(OP_SYNC_INFO);
}
}
return operationList;
}
示例6: getAttributeList
import com.sleepycat.je.EnvironmentConfig; //導入方法依賴的package包/類
@Override
protected MBeanAttributeInfo[] getAttributeList() {
ArrayList<MBeanAttributeInfo> attrList =
new ArrayList<MBeanAttributeInfo>();
if (env == null) {
return null;
}
/* Add attributes for all JE Environments. */
for (int i = 0; i < COMMON_ATTR.length; i++) {
attrList.add(COMMON_ATTR[i]);
}
/* Add attributes for an open Environment. */
for (int i = 0; i < OPEN_ATTR.length; i++) {
attrList.add(OPEN_ATTR[i]);
}
/* Add attributes for an open, transactional Environment. */
try {
EnvironmentConfig config = env.getConfig();
if (config.getTransactional()) {
for (int i = 0; i < TRANSACTIONAL_ATTR.length; i++) {
attrList.add(TRANSACTIONAL_ATTR[i]);
}
}
} catch (DatabaseException ignore) {
/* ignore */
}
return attrList.toArray(new MBeanAttributeInfo[attrList.size()]);
}
示例7: checkEnvConfig
import com.sleepycat.je.EnvironmentConfig; //導入方法依賴的package包/類
/**
* Verifies that the environment config is suitable for a replicated
* environment.
*
* @param envConfig the environment config being checked.
*
* @throws IllegalArgumentException via ReplicatedEnvironment ctor.
*/
private static void checkEnvConfig(EnvironmentConfig envConfig)
throws IllegalArgumentException {
if (!envConfig.getTransactional()) {
throw new IllegalArgumentException
("A replicated environment must be transactional");
}
String logMemOnly = envConfig.getConfigParam
(EnvironmentParams.LOG_MEMORY_ONLY.getName());
if (Boolean.parseBoolean(logMemOnly)) {
throw new IllegalArgumentException
("A replicated environment must not log to memory");
}
}
示例8: getAttributeList
import com.sleepycat.je.EnvironmentConfig; //導入方法依賴的package包/類
/**
* Get MBean attribute metadata for this environment.
* @param targetEnv The target JE environment. May be null if the
* environment is not open.
* @return list of MBeanAttributeInfo objects describing the available
* attributes.
*/
public List getAttributeList(Environment targetEnv) {
/* Turn off reset because the mbean metadata is being refreshed. */
setNeedReset(false);
ArrayList attrList = new ArrayList();
/* Add attributes for all JE environments. */
for (int i = 0; i < COMMON_ATTR.length; i++) {
attrList.add(COMMON_ATTR[i]);
}
if (targetEnv == null) {
if (canConfigure) {
/* Add attributes for configuring an environment. */
for (int i = 0; i < CREATE_ATTR.length; i++) {
attrList.add(CREATE_ATTR[i]);
}
}
} else {
/* Add attributes for an open environment. */
for (int i = 0; i < OPEN_ATTR.length; i++) {
attrList.add(OPEN_ATTR[i]);
}
/* Add attributes for an open, transactional environment. */
try {
EnvironmentConfig config = targetEnv.getConfig();
if (config.getTransactional()) {
for (int i = 0; i < TRANSACTIONAL_ATTR.length; i++) {
attrList.add(TRANSACTIONAL_ATTR[i]);
}
}
} catch (DatabaseException ignore) {
/* ignore */
}
}
return attrList;
}
示例9: getAttribute
import com.sleepycat.je.EnvironmentConfig; //導入方法依賴的package包/類
/**
* Get an attribute value for the given environment. Check
* JEMBeanHelper.getNeedReset() after this call because the helper may
* detect that the environment has changed and that the MBean metadata
* should be reset.
*
* @param targetEnv The target JE environment. May be null if the
* environment is not open.
* @param attributeName attribute name.
* @return attribute value.
*/
public Object getAttribute(Environment targetEnv,
String attributeName)
throws AttributeNotFoundException,
MBeanException {
/* Sanity check. */
if (attributeName == null) {
throw new AttributeNotFoundException(
"Attribute name cannot be null");
}
/* These attributes are available regardless of environment state. */
try {
if (attributeName.equals(ATT_ENV_HOME)) {
return environmentHome.getCanonicalPath();
} else if (attributeName.equals(ATT_OPEN)) {
boolean envIsOpen = (targetEnv != null);
resetIfOpenStateChanged(envIsOpen);
return new Boolean(envIsOpen);
} else if (attributeName.equals(ATT_SET_READ_ONLY)) {
return new Boolean(openConfig.getReadOnly());
} else if (attributeName.equals(ATT_SET_TRANSACTIONAL)) {
return new Boolean(openConfig.getTransactional());
} else if (attributeName.equals(ATT_SET_SERIALIZABLE)) {
return new Boolean(openConfig.getTxnSerializableIsolation());
} else {
/* The rest are JE environment attributes. */
if (targetEnv != null) {
EnvironmentConfig config = targetEnv.getConfig();
if (attributeName.equals(ATT_IS_READ_ONLY)) {
return new Boolean(config.getReadOnly());
} else if (attributeName.equals(ATT_IS_TRANSACTIONAL)) {
return new Boolean(config.getTransactional());
} else if (attributeName.equals(ATT_CACHE_SIZE)) {
return new Long(config.getCacheSize());
} else if (attributeName.equals(ATT_CACHE_PERCENT)) {
return new Integer(config.getCachePercent());
} else if (attributeName.equals(ATT_LOCK_TIMEOUT)) {
return new Long(config.getLockTimeout());
} else if (attributeName.equals(ATT_IS_SERIALIZABLE)) {
return new
Boolean(config.getTxnSerializableIsolation());
} else if (attributeName.equals(ATT_TXN_TIMEOUT)) {
return new Long(config.getTxnTimeout());
} else {
throw new AttributeNotFoundException("attribute " +
attributeName +
" is not valid.");
}
}
return null;
}
} catch (Exception e) {
/*
* Add both the message and the exception for easiest deciphering
* of the problem. Sometimes the original exception stacktrace gets
* hidden in server logs.
*/
throw new MBeanException(e, e.getMessage());
}
}
示例10: StoredClassCatalog
import com.sleepycat.je.EnvironmentConfig; //導入方法依賴的package包/類
/**
* Creates a catalog based on a given database. To save resources, only a
* single catalog object should be used for each unique catalog database.
*
* @param database an open database to use as the class catalog. It must
* be a BTREE database and must not allow duplicates.
*
* @throws DatabaseException if an error occurs accessing the database.
*
* @throws IllegalArgumentException if the database is not a BTREE database
* or if it configured to allow duplicates.
*/
public StoredClassCatalog(Database database)
throws DatabaseException, IllegalArgumentException {
db = database;
DatabaseConfig dbConfig = db.getConfig();
EnvironmentConfig envConfig = db.getEnvironment().getConfig();
writeLockMode = (DbCompat.getInitializeLocking(envConfig) ||
envConfig.getTransactional()) ? LockMode.RMW
: LockMode.DEFAULT;
cdbMode = DbCompat.getInitializeCDB(envConfig);
txnMode = dbConfig.getTransactional();
if (!DbCompat.isTypeBtree(dbConfig)) {
throw new IllegalArgumentException(
"The class catalog must be a BTREE database.");
}
if (DbCompat.getSortedDuplicates(dbConfig) ||
DbCompat.getUnsortedDuplicates(dbConfig)) {
throw new IllegalArgumentException(
"The class catalog database must not allow duplicates.");
}
/*
* Create the class format and class info maps. Note that these are not
* synchronized, and therefore the methods that use them are
* synchronized.
*/
classMap = new HashMap();
formatMap = new HashMap();
DatabaseEntry key = new DatabaseEntry(LAST_CLASS_ID_KEY);
DatabaseEntry data = new DatabaseEntry();
if (dbConfig.getReadOnly()) {
/* Check that the class ID record exists. */
OperationStatus status = db.get(null, key, data, null);
if (status != OperationStatus.SUCCESS) {
throw new IllegalStateException
("A read-only catalog database may not be empty");
}
} else {
/* Add the initial class ID record if it doesn't exist. */
data.setData(new byte[1]); // zero ID
/* Use putNoOverwrite to avoid phantoms. */
db.putNoOverwrite(null, key, data);
}
}
示例11: getAttributeList
import com.sleepycat.je.EnvironmentConfig; //導入方法依賴的package包/類
/**
* Get MBean attribute metadata for this environment.
* @param targetEnv The target JE environment. May be null if the
* environment is not open.
* @return list of MBeanAttributeInfo objects describing the available
* attributes.
*/
public List getAttributeList(Environment targetEnv) {
/* Turn off reset because the mbean metadata is being refreshed. */
setNeedReset(false);
ArrayList attrList = new ArrayList();
/* Add attributes for all JE environments. */
for (int i = 0; i < COMMON_ATTR.length; i++) {
attrList.add(COMMON_ATTR[i]);
}
if (targetEnv == null) {
if (canConfigure) {
/* Add attributes for configuring an environment. */
for (int i = 0; i < CREATE_ATTR.length; i++) {
attrList.add(CREATE_ATTR[i]);
}
}
} else {
/* Add attributes for an open environment. */
for (int i = 0; i < OPEN_ATTR.length; i++) {
attrList.add(OPEN_ATTR[i]);
}
/* Add attributes for an open, transactional environment. */
try {
EnvironmentConfig config = targetEnv.getConfig();
if (config.getTransactional()) {
for (int i = 0; i < TRANSACTIONAL_ATTR.length; i++) {
attrList.add(TRANSACTIONAL_ATTR[i]);
}
}
} catch (DatabaseException ignore) {
/* ignore */
}
}
return attrList;
}
示例12: getAttribute
import com.sleepycat.je.EnvironmentConfig; //導入方法依賴的package包/類
/**
* Get an attribute value for the given environment. Check
* JEMBeanHelper.getNeedReset() after this call because the helper may
* detect that the environment has changed and that the MBean metadata
* should be reset.
*
* @param targetEnv The target JE environment. May be null if the
* environment is not open.
* @param attributeName attribute name.
* @return attribute value.
*/
public Object getAttribute(Environment targetEnv,
String attributeName)
throws AttributeNotFoundException,
MBeanException {
/* Sanity check. */
if (attributeName == null) {
throw new AttributeNotFoundException(
"Attribute name cannot be null");
}
/* These attributes are available regardless of environment state. */
try {
if (attributeName.equals(ATT_ENV_HOME)) {
return environmentHome.getCanonicalPath();
} else if (attributeName.equals(ATT_OPEN)) {
boolean envIsOpen = (targetEnv != null);
resetIfOpenStateChanged(envIsOpen);
return new Boolean(envIsOpen);
} else if (attributeName.equals(ATT_SET_READ_ONLY)) {
return new Boolean(openConfig.getReadOnly());
} else if (attributeName.equals(ATT_SET_TRANSACTIONAL)) {
return new Boolean(openConfig.getTransactional());
} else if (attributeName.equals(ATT_SET_SERIALIZABLE)) {
return new Boolean(openConfig.getTxnSerializableIsolation());
} else {
/* The rest are JE environment attributes. */
if (targetEnv != null) {
EnvironmentConfig config = targetEnv.getConfig();
if (attributeName.equals(ATT_IS_READ_ONLY)) {
return new Boolean(config.getReadOnly());
} else if (attributeName.equals(ATT_IS_TRANSACTIONAL)) {
return new Boolean(config.getTransactional());
} else if (attributeName.equals(ATT_CACHE_SIZE)) {
return new Long(config.getCacheSize());
} else if (attributeName.equals(ATT_CACHE_PERCENT)) {
return new Integer(config.getCachePercent());
} else if (attributeName.equals(ATT_LOCK_TIMEOUT)) {
return new Long(config.getLockTimeout());
} else if (attributeName.equals(ATT_IS_SERIALIZABLE)) {
return new
Boolean(config.getTxnSerializableIsolation());
} else if (attributeName.equals(ATT_TXN_TIMEOUT)) {
return new Long(config.getTxnTimeout());
} else {
throw new AttributeNotFoundException("attribute " +
attributeName +
" is not valid.");
}
}
return null;
}
} catch (Exception e) {
/*
* Add both the message and the exception for easiest deciphering
* of the problem. Sometimes the original exception stacktrace gets
* hidden in server logs.
*/
throw new MBeanException(e, e.getMessage());
}
}
示例13: getAttributeList
import com.sleepycat.je.EnvironmentConfig; //導入方法依賴的package包/類
/**
* Get MBean attribute metadata for this environment.
* @param targetEnv The target JE environment. May be null if the
* environment is not open.
* @return list of MBeanAttributeInfo objects describing the available
* attributes.
*/
public List<MBeanAttributeInfo> getAttributeList(Environment targetEnv) {
/* Turn off reset because the mbean metadata is being refreshed. */
setNeedReset(false);
ArrayList<MBeanAttributeInfo> attrList =
new ArrayList<MBeanAttributeInfo>();
/* Add attributes for all JE environments. */
for (int i = 0; i < COMMON_ATTR.length; i++) {
attrList.add(COMMON_ATTR[i]);
}
if (targetEnv == null) {
if (canConfigure) {
/* Add attributes for configuring an environment. */
for (int i = 0; i < CREATE_ATTR.length; i++) {
attrList.add(CREATE_ATTR[i]);
}
}
} else {
/* Add attributes for an open environment. */
for (int i = 0; i < OPEN_ATTR.length; i++) {
attrList.add(OPEN_ATTR[i]);
}
/* Add attributes for an open, transactional environment. */
try {
EnvironmentConfig config = targetEnv.getConfig();
if (config.getTransactional()) {
for (int i = 0; i < TRANSACTIONAL_ATTR.length; i++) {
attrList.add(TRANSACTIONAL_ATTR[i]);
}
}
} catch (DatabaseException ignore) {
/* ignore */
}
}
return attrList;
}
示例14: getAttribute
import com.sleepycat.je.EnvironmentConfig; //導入方法依賴的package包/類
/**
* Get an attribute value for the given environment. Check
* JEMBeanHelper.getNeedReset() after this call because the helper may
* detect that the environment has changed and that the MBean metadata
* should be reset.
*
* @param targetEnv The target JE environment. May be null if the
* environment is not open.
* @param attributeName attribute name.
* @return attribute value.
*/
public Object getAttribute(Environment targetEnv, String attributeName)
throws AttributeNotFoundException,
MBeanException {
/* Sanity check. */
if (attributeName == null) {
throw new AttributeNotFoundException
("Attribute name cannot be null");
}
/* These attributes are available regardless of environment state. */
try {
if (attributeName.equals(ATT_ENV_HOME)) {
return environmentHome.getCanonicalPath();
} else if (attributeName.equals(ATT_OPEN)) {
boolean envIsOpen = (targetEnv != null);
resetIfOpenStateChanged(envIsOpen);
return new Boolean(envIsOpen);
} else if (attributeName.equals(ATT_SET_READ_ONLY)) {
return new Boolean(openConfig.getReadOnly());
} else if (attributeName.equals(ATT_SET_TRANSACTIONAL)) {
return new Boolean(openConfig.getTransactional());
} else if (attributeName.equals(ATT_SET_SERIALIZABLE)) {
return new Boolean(openConfig.getTxnSerializableIsolation());
} else {
/* The rest are JE environment attributes. */
if (targetEnv != null) {
EnvironmentConfig config = targetEnv.getConfig();
if (attributeName.equals(ATT_IS_READ_ONLY)) {
return new Boolean(config.getReadOnly());
} else if (attributeName.equals(ATT_IS_TRANSACTIONAL)) {
return new Boolean(config.getTransactional());
} else if (attributeName.equals(ATT_CACHE_SIZE)) {
return new Long(config.getCacheSize());
} else if (attributeName.equals(ATT_CACHE_PERCENT)) {
return new Integer(config.getCachePercent());
} else if (attributeName.equals(ATT_LOCK_TIMEOUT)) {
return new Long(config.getLockTimeout());
} else if (attributeName.equals(ATT_IS_SERIALIZABLE)) {
return new
Boolean(config.getTxnSerializableIsolation());
} else if (attributeName.equals(ATT_TXN_TIMEOUT)) {
return new Long(config.getTxnTimeout());
} else {
throw new AttributeNotFoundException
("attribute " + attributeName + " is not valid.");
}
}
return null;
}
} catch (Exception e) {
/*
* Add both the message and the exception for easiest deciphering
* of the problem. Sometimes the original exception stacktrace gets
* hidden in server logs.
*/
throw new MBeanException(e, e.getMessage());
}
}