CADI.Proxy.Core
Class ProxyMutex

java.lang.Object
  extended by CADI.Proxy.Core.ProxyMutex

public class ProxyMutex
extends java.lang.Object

This class implements a mutex used to control when the threads that are attending to a client request are busy. Therefore, while some thread is is attending to a client, the proxy prefetching must be sleeping, and only will be awoken when threre not exist any client's request waiting.

Usage example:
setLock
releaseLock

Version:
1.0 2009/10/13
Author:
Group on Interactive Coding of Images (GICI)

Field Summary
private  int averageLocks
           
private  int numLocks
          Indicates the number of threads that are responding to client's requests
private  StopWatch stopWatch
           
private  int tmpLocks
           
 
Constructor Summary
ProxyMutex()
           
 
Method Summary
 int getLockAverage()
           
 boolean isRealeasedLock()
           
 void list(java.io.PrintStream out)
          Prints this Proxy Mutex out to the specified output stream.
 void releaseLock()
           
 void resetAverage()
           
 void setLock()
           
 void startLockAverage()
           
 void stopLockAverage()
           
 java.lang.String toString()
           
 void waitReleaseLock()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

numLocks

private volatile int numLocks
Indicates the number of threads that are responding to client's requests


stopWatch

private StopWatch stopWatch

tmpLocks

private int tmpLocks

averageLocks

private int averageLocks
Constructor Detail

ProxyMutex

public ProxyMutex()
Method Detail

setLock

public void setLock()

releaseLock

public void releaseLock()

waitReleaseLock

public void waitReleaseLock()
                     throws java.lang.InterruptedException
Throws:
java.lang.InterruptedException

isRealeasedLock

public boolean isRealeasedLock()

startLockAverage

public void startLockAverage()

stopLockAverage

public void stopLockAverage()

resetAverage

public void resetAverage()

getLockAverage

public int getLockAverage()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

list

public void list(java.io.PrintStream out)
Prints this Proxy Mutex out to the specified output stream. This method is useful for debugging.

Parameters:
out - an output stream.


CADI - Copyright (C) 2007
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

Group on Interactive Coding of Images (GICI) (contact)