mirror of https://github.com/apache/druid.git
cleanup
This commit is contained in:
parent
47696a6108
commit
a9952292f2
|
@ -35,39 +35,38 @@ import java.net.URI;
|
||||||
public class QuidemCaptureResource
|
public class QuidemCaptureResource
|
||||||
{
|
{
|
||||||
private URI quidemURI;
|
private URI quidemURI;
|
||||||
|
private QuidemRecorder recorder = null;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public QuidemCaptureResource(@Named("quidem") URI quidemURI)
|
public QuidemCaptureResource(@Named("quidem") URI quidemURI)
|
||||||
{
|
{
|
||||||
this.quidemURI = quidemURI;
|
this.quidemURI = quidemURI;
|
||||||
|
if (withAutoStart()) {
|
||||||
|
try {
|
||||||
|
start();
|
||||||
|
}
|
||||||
|
catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private QuidemRecorder recorder = null;
|
private boolean withAutoStart()
|
||||||
|
|
||||||
@GET
|
|
||||||
@Path("/")
|
|
||||||
@Produces(MediaType.TEXT_PLAIN)
|
|
||||||
public String getSome()
|
|
||||||
{
|
{
|
||||||
return "Asd";
|
return Boolean.valueOf(System.getProperty("quidem.autostart", "false"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("/start")
|
@Path("/start")
|
||||||
@Produces(MediaType.TEXT_PLAIN)
|
@Produces(MediaType.TEXT_PLAIN)
|
||||||
public synchronized String getSome1() throws IOException
|
public synchronized String start() throws IOException
|
||||||
{
|
{
|
||||||
stopIfRunning();
|
stopIfRunning();
|
||||||
start();
|
recorder = new QuidemRecorder(quidemURI, new PrintStream("/tmp/new.iq"));
|
||||||
return recorder.toString();
|
return recorder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void start() throws IOException
|
private synchronized void stopIfRunning()
|
||||||
{
|
|
||||||
recorder = new QuidemRecorder(quidemURI, new PrintStream("/tmp/new.iq"));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void stopIfRunning()
|
|
||||||
{
|
{
|
||||||
if (recorder != null) {
|
if (recorder != null) {
|
||||||
recorder.close();
|
recorder.close();
|
||||||
|
|
Loading…
Reference in New Issue