This repository has been archived by the owner on Mar 27, 2018. It is now read-only.
forked from py4j/py4j
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added a headless application to py4j/eclipse
- Loading branch information
Showing
2 changed files
with
90 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
net.sf.py4j.defaultserver/src/net/sf/py4j/defaultserver/HeadlessApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
package net.sf.py4j.defaultserver; | ||
|
||
import java.util.concurrent.CountDownLatch; | ||
|
||
import org.eclipse.equinox.app.IApplication; | ||
import org.eclipse.equinox.app.IApplicationContext; | ||
|
||
import py4j.GatewayServer; | ||
import py4j.GatewayServerListener; | ||
|
||
public class HeadlessApplication implements IApplication, GatewayServerListener { | ||
|
||
private CountDownLatch latch; | ||
|
||
@Override | ||
public Object start(IApplicationContext context) throws Exception { | ||
GatewayServer server = DefaultServerActivator.getDefault().getServer(); | ||
latch = new CountDownLatch(1); | ||
server.addListener(this); | ||
System.out.println("Py4J Headless Application Started."); | ||
Object result = IApplication.EXIT_OK; | ||
try { | ||
latch.await(); | ||
} catch(Exception e) { | ||
result = new Integer(1); | ||
} | ||
return result; | ||
} | ||
|
||
@Override | ||
public void stop() { | ||
|
||
} | ||
|
||
@Override | ||
public void serverStarted() { | ||
|
||
} | ||
|
||
@Override | ||
public void serverStopped() { | ||
|
||
} | ||
|
||
@Override | ||
public void serverError(Exception e) { | ||
|
||
} | ||
|
||
@Override | ||
public void serverPreShutdown() { | ||
|
||
} | ||
|
||
@Override | ||
public void serverPostShutdown() { | ||
System.out.println("Py4J Headless Application Stopping."); | ||
latch.countDown(); | ||
} | ||
|
||
@Override | ||
public void connectionStarted() { | ||
|
||
} | ||
|
||
@Override | ||
public void connectionStopped() { | ||
|
||
} | ||
|
||
@Override | ||
public void connectionError(Exception e) { | ||
|
||
} | ||
|
||
|
||
|
||
} |