本文整理汇总了Java中com.sun.corba.se.impl.orbutil.ORBUtility.dprintTrace方法的典型用法代码示例。如果您正苦于以下问题:Java ORBUtility.dprintTrace方法的具体用法?Java ORBUtility.dprintTrace怎么用?Java ORBUtility.dprintTrace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.corba.se.impl.orbutil.ORBUtility
的用法示例。
在下文中一共展示了ORBUtility.dprintTrace方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: release
import com.sun.corba.se.impl.orbutil.ORBUtility; //导入方法依赖的package包/类
public synchronized void release()
{
try {
if (debug)
ORBUtility.dprintTrace( this, "release enter: " +
" holder_=" + ORBUtility.getThreadName(holder_) +
" counter_=" + counter_ ) ;
Thread thr = Thread.currentThread();
if (thr != holder_)
throw new INTERNAL(
"Attempt to release Mutex by thread not holding the Mutex" ) ;
else
counter_ -- ;
if (counter_ == 0) {
holder_ = null;
notify();
}
} finally {
if (debug)
ORBUtility.dprintTrace( this, "release exit: " +
" holder_=" + ORBUtility.getThreadName(holder_) +
" counter_=" + counter_ ) ;
}
}
示例2: releaseAll
import com.sun.corba.se.impl.orbutil.ORBUtility; //导入方法依赖的package包/类
synchronized int releaseAll()
{
try {
if (debug)
ORBUtility.dprintTrace( this, "releaseAll enter: " +
" holder_=" + ORBUtility.getThreadName(holder_) +
" counter_=" + counter_ ) ;
Thread thr = Thread.currentThread();
if (thr != holder_)
throw new INTERNAL(
"Attempt to releaseAll Mutex by thread not holding the Mutex" ) ;
int result = counter_ ;
counter_ = 0 ;
holder_ = null ;
notify() ;
return result ;
} finally {
if (debug)
ORBUtility.dprintTrace( this, "releaseAll exit: " +
" holder_=" + ORBUtility.getThreadName(holder_) +
" counter_=" + counter_ ) ;
}
}
示例3: acquire
import com.sun.corba.se.impl.orbutil.ORBUtility; //导入方法依赖的package包/类
public void acquire() throws InterruptedException {
if (Thread.interrupted())
throw new InterruptedException();
synchronized(this) {
try {
if (debug)
ORBUtility.dprintTrace( this,
"acquire enter: holder_=" +
ORBUtility.getThreadName(holder_) +
" counter_=" + counter_ ) ;
Thread thr = Thread.currentThread();
if (holder_ != thr) {
try {
while (counter_ > 0)
wait();
// This can't happen, but make sure anyway
if (counter_ != 0)
throw new INTERNAL(
"counter not 0 when first acquiring mutex" ) ;
holder_ = thr;
} catch (InterruptedException ex) {
notify();
throw ex;
}
}
counter_ ++ ;
} finally {
if (debug)
ORBUtility.dprintTrace( this, "acquire exit: holder_=" +
ORBUtility.getThreadName(holder_) + " counter_=" +
counter_ ) ;
}
}
}
示例4: acquireAll
import com.sun.corba.se.impl.orbutil.ORBUtility; //导入方法依赖的package包/类
void acquireAll( int count ) throws InterruptedException
{
if (Thread.interrupted())
throw new InterruptedException();
synchronized(this) {
try {
if (debug)
ORBUtility.dprintTrace( this,
"acquireAll enter: count=" + count + " holder_=" +
ORBUtility.getThreadName(holder_) + " counter_=" +
counter_ ) ;
Thread thr = Thread.currentThread();
if (holder_ == thr) {
throw new INTERNAL(
"Cannot acquireAll while holding the mutex" ) ;
} else {
try {
while (counter_ > 0)
wait();
// This can't happen, but make sure anyway
if (counter_ != 0)
throw new INTERNAL(
"counter not 0 when first acquiring mutex" ) ;
holder_ = thr;
} catch (InterruptedException ex) {
notify();
throw ex;
}
}
counter_ = count ;
} finally {
if (debug)
ORBUtility.dprintTrace( this, "acquireAll exit: count=" +
count + " holder_=" + ORBUtility.getThreadName(holder_) +
" counter_=" + counter_ ) ;
}
}
}
示例5: attempt
import com.sun.corba.se.impl.orbutil.ORBUtility; //导入方法依赖的package包/类
public boolean attempt(long msecs) throws InterruptedException {
if (Thread.interrupted())
throw new InterruptedException();
synchronized(this) {
try {
if (debug)
ORBUtility.dprintTrace( this, "attempt enter: msecs=" +
msecs + " holder_=" +
ORBUtility.getThreadName(holder_) +
" counter_=" + counter_ ) ;
Thread thr = Thread.currentThread() ;
if (counter_==0) {
holder_ = thr;
counter_ = 1 ;
return true;
} else if (msecs <= 0) {
return false;
} else {
long waitTime = msecs;
long start = System.currentTimeMillis();
try {
for (;;) {
wait(waitTime);
if (counter_==0) {
holder_ = thr;
counter_ = 1 ;
return true;
} else {
waitTime = msecs -
(System.currentTimeMillis() - start);
if (waitTime <= 0)
return false;
}
}
} catch (InterruptedException ex) {
notify();
throw ex;
}
}
} finally {
if (debug)
ORBUtility.dprintTrace( this, "attempt exit: " +
" holder_=" + ORBUtility.getThreadName(holder_) +
" counter_=" + counter_ ) ;
}
}
}