本文整理汇总了Java中org.apache.geode.LogWriter.fineEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java LogWriter.fineEnabled方法的具体用法?Java LogWriter.fineEnabled怎么用?Java LogWriter.fineEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.geode.LogWriter
的用法示例。
在下文中一共展示了LogWriter.fineEnabled方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: pause
import org.apache.geode.LogWriter; //导入方法依赖的package包/类
/** pause for specified ms interval
* Make sure system clock has advanced by the specified number of millis before
* returning.
*/
public static final void pause(int ms) {
LogWriter log = getLogWriter();
if (ms >= 1000 || log.fineEnabled()) { // check for fine but log at info
getLogWriter().info("Pausing for " + ms + " ms..."/*, new Exception()*/);
}
final long target = System.currentTimeMillis() + ms;
try {
for (;;) {
long msLeft = target - System.currentTimeMillis();
if (msLeft <= 0) {
break;
}
Thread.sleep(msLeft);
}
}
catch (InterruptedException e) {
fail("interrupted", e);
}
}
示例2: getConnection
import org.apache.geode.LogWriter; //导入方法依赖的package包/类
public Object getConnection(Subject arg0, ConnectionRequestInfo arg1) throws ResourceException {
if (DEBUG) {
try {
throw new NullPointerException("Asif:JCAManagedConnection:getConnection");
} catch (NullPointerException npe) {
npe.printStackTrace();
}
}
try {
if (!this.initDone || this.cache.isClosed()) {
init();
}
LogWriter logger = this.cache.getLogger();
if (logger.fineEnabled()) {
logger.fine("JCAManagedConnection:getConnection. Returning new Connection");
}
GFConnectionImpl conn = new GFConnectionImpl(this);
this.connections.add(conn);
return conn;
} catch (SystemException e) {
this.onError(e);
throw new ResourceException("GemFire Resource unavailable", e);
}
}
示例3: getMetaData
import org.apache.geode.LogWriter; //导入方法依赖的package包/类
public ManagedConnectionMetaData getMetaData() throws ResourceException {
if (DEBUG) {
try {
throw new NullPointerException("Asif:JCAManagedConnection:getMetaData");
} catch (NullPointerException npe) {
npe.printStackTrace();
}
}
if (this.initDone && !this.cache.isClosed()) {
LogWriter logger = this.cache.getLogger();
if (logger.fineEnabled()) {
logger.fine("JCAManagedConnection:getMetaData");
}
}
return new JCAManagedConnectionMetaData(this.factory.getProductName(),
this.factory.getVersion(), this.factory.getUserName());
}
示例4: createPerformanceLogger
import org.apache.geode.LogWriter; //导入方法依赖的package包/类
@Override
protected PerformanceLogger createPerformanceLogger() {
final LogWriter logWriter = createLogWriter();
final PerformanceLogger perfLogger = new PerformanceLogger() {
@Override
public void log(final String message) {
logWriter.fine(message);
}
@Override
public boolean isEnabled() {
return logWriter.fineEnabled();
}
};
return perfLogger;
}
示例5: init
import org.apache.geode.LogWriter; //导入方法依赖的package包/类
private void init() throws SystemException {
this.cache = (GemFireCacheImpl) CacheFactory.getAnyInstance();
LogWriter logger = this.cache.getLogger();
if (logger.fineEnabled()) {
logger.fine("JCAManagedConnection:init. Inside init");
}
gfTxMgr = cache.getTxManager();
this.initDone = true;
}
示例6: commit
import org.apache.geode.LogWriter; //导入方法依赖的package包/类
public void commit() throws ResourceException {
if (DEBUG) {
try {
throw new NullPointerException("Asif:JCALocalTransaction:commit");
} catch (NullPointerException npe) {
npe.printStackTrace();
}
}
LogWriter logger = cache.getLogger();
if (logger.fineEnabled()) {
logger.fine("JCALocalTransaction:invoked commit");
}
TXStateProxy tsp = this.gfTxMgr.getTXState();
if (tsp != null && this.tid != tsp.getTransactionId()) {
throw new IllegalStateException("Local Transaction associated with Tid = " + this.tid
+ " attempting to commit a different transaction");
}
try {
this.gfTxMgr.commit();
this.tid = null;
} catch (Exception e) {
throw new LocalTransactionException(e.toString());
}
// Iterator<ConnectionEventListener> itr = this.listeners.iterator();
// ConnectionEvent ce = new
// ConnectionEvent(this,ConnectionEvent.LOCAL_TRANSACTION_COMMITTED);
// while( itr.hasNext()) {
// itr.next().localTransactionCommitted(ce);
// }
}
示例7: getQueryRegionsAssociatedMembers
import org.apache.geode.LogWriter; //导入方法依赖的package包/类
public static Set<DistributedMember> getQueryRegionsAssociatedMembers(Set<String> regions,
final Cache cache, boolean returnAll) {
LogWriter logger = cache.getLogger();
Set<DistributedMember> members = null;
Set<DistributedMember> newMembers = null;
Iterator<String> iterator = regions.iterator();
String region = (String) iterator.next();
members = getRegionAssociatedMembers(region, cache, true);
if (logger.fineEnabled())
logger.fine("Members for region " + region + " Members " + members);
List<String> regionAndingList = new ArrayList<String>();
regionAndingList.add(region);
if (regions.size() == 1) {
newMembers = members;
} else {
if (members != null && !members.isEmpty()) {
while (iterator.hasNext()) {
region = iterator.next();
newMembers = getRegionAssociatedMembers(region, cache, true);
if (newMembers == null) {
newMembers = new HashSet<DistributedMember>();
}
if (logger.fineEnabled())
logger.fine("Members for region " + region + " Members " + newMembers);
regionAndingList.add(region);
newMembers.retainAll(members);
members = newMembers;
if (logger.fineEnabled())
logger.fine(
"Members after anding for regions " + regionAndingList + " List : " + newMembers);
}
}
}
members = new HashSet<DistributedMember>();
if (newMembers == null)
return members;
Iterator<DistributedMember> memberIterator = newMembers.iterator();
while (memberIterator.hasNext()) {
members.add(memberIterator.next());
if (!returnAll) {
return members;
}
}
return members;
}
示例8: begin
import org.apache.geode.LogWriter; //导入方法依赖的package包/类
public void begin() throws ResourceException {
if (DEBUG) {
try {
throw new NullPointerException("Asif:JCALocalTransaction:begin");
} catch (NullPointerException npe) {
npe.printStackTrace();
}
}
try {
if (!initDone || this.cache.isClosed()) {
this.init();
}
// System.out.println("JCALocalTransaction:Asif: cache is ="+cache +
// " for tx ="+this);
LogWriter logger = cache.getLogger();
if (logger.fineEnabled()) {
logger.fine("JCALocalTransaction::begin:");
}
TransactionManager tm = cache.getJTATransactionManager();
if (this.tid != null) {
throw new LocalTransactionException(" A transaction is already in progress");
}
if (tm != null && tm.getTransaction() != null) {
if (logger.fineEnabled()) {
logger.fine("JCAManagedConnection: JTA transaction is on");
}
// This is having a JTA transaction. Assuming ignore jta flag is true,
// explicitly being a gemfire transaction.
TXStateProxy tsp = this.gfTxMgr.getTXState();
if (tsp == null) {
this.gfTxMgr.begin();
tsp = this.gfTxMgr.getTXState();
tsp.setJCATransaction();
this.tid = tsp.getTransactionId();
if (logger.fineEnabled()) {
logger.fine("JCALocalTransaction:begun GFE transaction");
}
} else {
throw new LocalTransactionException("GemFire is already associated with a transaction");
}
} else {
if (logger.fineEnabled()) {
logger.fine("JCAManagedConnection: JTA Transaction does not exist.");
}
}
} catch (SystemException e) {
// this.onError();
throw new ResourceException(e);
}
// Not to be invoked for local transactions managed by the container
// Iterator<ConnectionEventListener> itr = this.listeners.iterator();
// ConnectionEvent ce = new ConnectionEvent(this,
// ConnectionEvent.LOCAL_TRANSACTION_STARTED);
// while (itr.hasNext()) {
// itr.next().localTransactionStarted(ce);
// }
}
示例9: rollback
import org.apache.geode.LogWriter; //导入方法依赖的package包/类
public void rollback() throws ResourceException {
if (DEBUG) {
try {
throw new NullPointerException("Asif:JJCALocalTransaction:rollback");
} catch (NullPointerException npe) {
npe.printStackTrace();
}
}
TXStateProxy tsp = this.gfTxMgr.getTXState();
if (tsp != null && this.tid != tsp.getTransactionId()) {
throw new IllegalStateException("Local Transaction associated with Tid = " + this.tid
+ " attempting to commit a different transaction");
}
LogWriter logger = cache.getLogger();
if (logger.fineEnabled()) {
logger.fine("JCALocalTransaction:invoked rollback");
}
try {
this.gfTxMgr.rollback();
} catch (IllegalStateException ise) {
// It is possible that the GFE transaction has already been rolled back.
if (ise.getMessage()
.equals(LocalizedStrings.TXManagerImpl_THREAD_DOES_NOT_HAVE_AN_ACTIVE_TRANSACTION
.toLocalizedString())) {
// /ignore;
} else {
throw new ResourceException(ise);
}
} catch (Exception e) {
throw new ResourceException(e);
} finally {
this.tid = null;
}
// Iterator<ConnectionEventListener> itr = this.listeners.iterator();
// ConnectionEvent ce = new ConnectionEvent(this,
// ConnectionEvent.LOCAL_TRANSACTION_ROLLEDBACK);
// while (itr.hasNext()) {
// itr.next().localTransactionRolledback(ce);
// }
}
示例10: run
import org.apache.geode.LogWriter; //导入方法依赖的package包/类
@Override
public void run() {
Region rgn = cache.getRegion("test_region");
int counter = 0;
LogWriter logger = cache.getLogger();
Conflatable cnf;
try {
while (toCnt) {
Thread.sleep(20);
// Thread.currentThread().getName() + " before doing operation of
// type= "+ this.opType);
switch (opType) {
case PUT:
rgn.put("key" + threadID, "val" + counter++);
if (counter == 10)
counter = 0;
break;
case TAKE:
cnf = (Conflatable) hrq.take();
if (logger.fineEnabled() && cnf != null) {
logger.fine("Object retrieved by take has key =" + cnf.getKeyToConflate()
+ " and value as" + cnf.getValueToConflate());
}
break;
case PEEK:
cnf = (Conflatable) hrq.peek();
if (logger.fineEnabled() && cnf != null) {
logger.fine("Object retrieved by peek has key =" + cnf.getKeyToConflate()
+ " and value as" + cnf.getValueToConflate());
}
// Thread.currentThread().getName() + " before doing remove= "+
// this.opType);
hrq.remove();
break;
case BATCH_PEEK:
List confList = hrq.peek(3, 2000);
if (logger.fineEnabled() && confList != null) {
logger.fine("Object retrieved by batch peek are =" + confList);
}
// Thread.currentThread().getName() + " before doing remove= "+
// this.opType);
hrq.remove();
break;
}
// Thread.currentThread().getName() + " after Operation of type= "+
// this.opType);
}
} catch (Exception e) {
throw new AssertionError(e);
}
}