Java Code Examples for com.sun.corba.se.impl.orbutil.ORBUtility#dprintTrace()

The following examples show how to use com.sun.corba.se.impl.orbutil.ORBUtility#dprintTrace() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ReentrantMutex.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
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_ ) ;
    }
}
 
Example 2
Source File: ReentrantMutex.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
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_ ) ;
    }
}
 
Example 3
Source File: ReentrantMutex.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
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_ ) ;
    }
}
 
Example 4
Source File: ReentrantMutex.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
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_ ) ;
    }
}
 
Example 5
Source File: ReentrantMutex.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
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_ ) ;
    }
}
 
Example 6
Source File: ReentrantMutex.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
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_ ) ;
        }
    }
}
 
Example 7
Source File: ReentrantMutex.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
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_ ) ;
        }
    }
}
 
Example 8
Source File: ReentrantMutex.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
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_ ) ;
        }
    }
}
 
Example 9
Source File: ReentrantMutex.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
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_ ) ;
        }
    }
}
 
Example 10
Source File: ReentrantMutex.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
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_ ) ;
        }
    }
}
 
Example 11
Source File: ReentrantMutex.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
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_ ) ;
        }
    }
}
 
Example 12
Source File: ReentrantMutex.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
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_ ) ;
        }
    }
}
 
Example 13
Source File: ReentrantMutex.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
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_ ) ;
        }
    }
}
 
Example 14
Source File: ReentrantMutex.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
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_ ) ;
        }
    }
}
 
Example 15
Source File: ReentrantMutex.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
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_ ) ;
        }
    }
}
 
Example 16
Source File: ReentrantMutex.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
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_ ) ;
        }
    }
}
 
Example 17
Source File: ReentrantMutex.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
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_ ) ;
        }
    }
}
 
Example 18
Source File: ReentrantMutex.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
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_ ) ;
        }
    }
}
 
Example 19
Source File: ReentrantMutex.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
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_ ) ;
        }
    }
}
 
Example 20
Source File: ReentrantMutex.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
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_ ) ;
        }
    }
}