Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SpectraAnalyzer, comment out print statements #24

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,8 @@
-/**/.settings
-
-media-server-docs/sources-mobicents/src
-client/jsr-309/tck/tck-run
-client/jsr-309/tck/tck-run
/bin/
/.classpath
/.project
/.settings/
1 change: 1 addition & 0 deletions client/mgcp/driver/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target/
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public AudioOutput getAudioOutput()
public void activate()
{
this.len = 0;
System.out.println("start, len=" + len);
//System.out.println("start, len=" + len);
output.start();
}

Expand Down Expand Up @@ -132,7 +132,7 @@ private void append(ArrayList<Integer> list, int v) {

public int[] getSpectra() {
ArrayList<Integer> frequency = new ArrayList();
System.out.println("len=" + len);
//System.out.println("len=" + len);
int count = len / 8000;
for (int i = 0; i < count; i++) {
double[] data = new double[8000];
Expand Down
1 change: 1 addition & 0 deletions concurrent/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target/
1 change: 1 addition & 0 deletions hardware/dahdi/java/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target/
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class PortManager {
private int low = 1024, high=65534;
private int step=(high-low)/2;
//pointers
private AtomicInteger currPort = new AtomicInteger(0);
private static AtomicInteger currPort = new AtomicInteger(0);

/**
* Creates new instance.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,12 +348,27 @@ public void start() {
*/
public void stop() {
synchronized(LOCK) {
if (!this.isActive) return;

this.isActive = false;
for(int i=0;i<this.pollTasks.length;i++)
this.pollTasks[i].cancel();

// selectord are created in constructor so have to close regardless of whether started (active)
for(int i=0;i<this.selectors.length;i++)
{
try {
if (selectors[i] != null)
selectors[i].close();
} catch (IOException e) {
logger.error("Exception closing selector", e);
}
}

for(int i=0;i<pollTasks.length;i++) {
if (pollTasks[i] != null)
pollTasks[i].cancel();
}

if (!this.isActive) return;

logger.info("Stopped");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -797,5 +797,9 @@ public long perform() {
}
return 0;
}
}
}

public JitterBuffer getRxBuffer() {
return rxBuffer;
}
}
1 change: 1 addition & 0 deletions io/ss7/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target/
1 change: 1 addition & 0 deletions media-server-docs/sources-mobicents/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/target
/src/
53 changes: 46 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,15 @@
<release.name>
${release.name.prefix}${parent.version}${release.name.suffix}
</release.name>

<maven.repo>dev</maven.repo>

<version.junit>4.4</version.junit>
<version.xerces>2.9.1</version.xerces>
<log4j.version>1.2.12</log4j.version>
<concurrent.version>1.3.4</concurrent.version>
<version.freetts>1.2.2</version.freetts>
<version.jboss.microcontainer>2.2.0.M2</version.jboss.microcontainer>
<version.junit>4.4</version.junit>
<version.xerces>2.9.1</version.xerces>
<log4j.version>1.2.12</log4j.version>
<concurrent.version>1.3.4</concurrent.version>
<version.freetts>1.2.2</version.freetts>
<version.jboss.microcontainer>2.2.0.M2</version.jboss.microcontainer>

<!--mobicents.tools.mavenplugin.eclipse.version>
1.0.0.BETA2
Expand Down Expand Up @@ -218,6 +220,14 @@
</configuration>
</plugin>
</plugins>
<extensions>
<extension>
<groupId>org.springframework.build</groupId>
<artifactId>aws-maven</artifactId>
<version>5.0.0.RELEASE</version>
</extension>
</extensions>

</build>


Expand Down Expand Up @@ -260,6 +270,10 @@
<name>jboss-deprecated</name>
<url>http://repository.jboss.org/nexus/content/repositories/deprecated</url>
</repository>
<repository>
<id>pgi-nexus-repo</id>
<url>http://maven.bobdev.pgi.com:9090/nexus/content/groups/public</url>
</repository>
</repositories>

<pluginRepositories>
Expand All @@ -279,5 +293,30 @@
</pluginRepository>
</pluginRepositories>


<distributionManagement>

<repository>
<id>deployment</id>
<name>Internal Releases</name>
<url>http://maven.bobdev.pgi.com:9090/nexus/content/repositories/releases/</url>
</repository>
<snapshotRepository>
<id>deployment</id>
<name>Internal Releases</name>
<url>http://maven.bobdev.pgi.com:9090/nexus/content/repositories/snapshots/</url>
</snapshotRepository>

<!-- <repository>
<id>aws-release-${maven.repo}</id>
<name>AWS Release Repository</name>
<url>s3://bob-maven-repo-${maven.repo}/release</url>
</repository>
<snapshotRepository>
<id>aws-snapshot-${maven.repo}</id>
<name>AWS Snapshot Repository</name>
<url>s3://bob-maven-repo-${maven.repo}/snapshot</url>
</snapshotRepository>
-->
</distributionManagement>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,16 @@ public Scheduler() {
for(int i=0;i<heartBeatQueue.length;i++)
heartBeatQueue[i]=new OrderedTaskQueue();

coreThread = new CoreThread(String.format("Scheduler"));
criticalThread = new CriticalThread(String.format("Scheduler"));
coreThread = new CoreThread(String.format("Scheduler-coreThread"));
criticalThread = new CriticalThread(String.format("Scheduler-criticalThread"));

workerThreads=new WorkerThread[Runtime.getRuntime().availableProcessors()*2];
criticalWorkerThreads=new CriticalWorkerThread[Runtime.getRuntime().availableProcessors()*2];
for(int i=0;i<workerThreads.length;i++)
workerThreads[i]=new WorkerThread();
workerThreads[i]=new WorkerThread("Scheduler-workerThread-" + i);

for(int i=0;i<criticalWorkerThreads.length;i++)
criticalWorkerThreads[i]=new CriticalWorkerThread();
criticalWorkerThreads[i]=new CriticalWorkerThread("Scheduler-criticalWorkerThread-" + i);
}

public int getPoolSize()
Expand Down Expand Up @@ -262,28 +262,40 @@ public void run() {
{
long taskStart=cycleStart;
currQueue=MANAGEMENT_QUEUE;
while(currQueue<=OUTPUT_QUEUE)
while(currQueue<=OUTPUT_QUEUE && active)
{
executeQueue(taskQueues[currQueue]);
while(activeTasksCount.get()!=0)
while(activeTasksCount.get()!=0 && active)
LockSupport.park();

currQueue++;
}

if (!active)
return;

executeQueue(taskQueues[MANAGEMENT_QUEUE]);
while(activeTasksCount.get()!=0)
while(activeTasksCount.get()!=0 && active)
LockSupport.park();

if (!active)
return;

runIndex=(runIndex+1)%5;
executeQueue(heartBeatQueue[runIndex]);
while(activeTasksCount.get()!=0)
while(activeTasksCount.get()!=0 && active)
LockSupport.park();

if (!active)
return;

executeQueue(taskQueues[MANAGEMENT_QUEUE]);
while(activeTasksCount.get()!=0)
while(activeTasksCount.get()!=0 && active)
LockSupport.park();

if (!active)
return;

//sleep till next cycle
cycleDuration=clock.getTime() - cycleStart;
if(cycleDuration<20000000L)
Expand All @@ -306,7 +318,7 @@ private void executeQueue(OrderedTaskQueue currQueue)
t = currQueue.poll();

//submit all tasks in current queue
while(t!=null)
while(t!=null && active)
{
activeTasksCount.incrementAndGet();
waitingTasks.offer(t);
Expand All @@ -319,6 +331,7 @@ private void executeQueue(OrderedTaskQueue currQueue)
*/
private void shutdown() {
this.active = false;
interrupt();
}
}

Expand Down Expand Up @@ -353,13 +366,19 @@ public void run() {
while(active)
{
executeQueue(taskQueues[RECEIVER_QUEUE]);
while(activeTasksCount.get()!=0)
while(activeTasksCount.get()!=0 && active)
LockSupport.park();

if (!active)
return;

executeQueue(taskQueues[SENDER_QUEUE]);
while(activeTasksCount.get()!=0)
while(activeTasksCount.get()!=0 && active)
LockSupport.park();

if (!active)
return;

//sleep till next cycle
cycleDuration=clock.getTime() - cycleStart;
if(cycleDuration<4000000L)
Expand All @@ -382,7 +401,7 @@ private void executeQueue(OrderedTaskQueue currQueue)
t = currQueue.poll();

//submit all tasks in current queue
while(t!=null)
while(t!=null && active)
{
activeTasksCount.incrementAndGet();
criticalTasks.offer(t);
Expand All @@ -395,18 +414,23 @@ private void executeQueue(OrderedTaskQueue currQueue)
*/
private void shutdown() {
this.active = false;
interrupt();
}
}

private class WorkerThread extends Thread {
private volatile boolean active;
private Task current;

private WorkerThread(String name) {
super(name);
}

public void run() {
while(active)
{
current=null;
while(current==null)
while(current==null && active)
{
try
{
Expand All @@ -417,7 +441,8 @@ public void run() {

}
}
current.run();
if (current != null)
current.run();
coreThread.notifyCompletion();
}
}
Expand All @@ -432,18 +457,23 @@ public void activate() {
*/
private void shutdown() {
this.active = false;
interrupt();
}
}

private class CriticalWorkerThread extends Thread {
private volatile boolean active;
private Task current;

private CriticalWorkerThread(String name) {
super(name);
}

public void run() {
while(active)
{
current=null;
while(current==null)
while(current==null && active)
{
try
{
Expand All @@ -454,7 +484,8 @@ public void run() {

}
}
current.run();
if (current != null)
current.run();
criticalThread.notifyCompletion();
}
}
Expand All @@ -469,6 +500,7 @@ public void activate() {
*/
private void shutdown() {
this.active = false;
interrupt();
}
}
}