Minor Changes

This commit is contained in:
ME1312 2017-07-25 15:27:40 -04:00
parent 8b65ec04dd
commit e766f7fa22
10 changed files with 29 additions and 26 deletions

Binary file not shown.

Binary file not shown.

View File

@ -185,7 +185,7 @@ extends java.lang.Object</pre>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code><a href="../../../../../net/ME1312/SubServers/Host/Executable/SubLogger.html" title="class in net.ME1312.SubServers.Host.Executable">SubLogger</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../net/ME1312/SubServers/Host/Executable/SubCreator.html#getLogger-java.lang.String-">getLogger</a></span>(java.lang.String&nbsp;thread)</code>&nbsp;</td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../net/ME1312/SubServers/Host/Executable/SubCreator.html#getLogger-java.lang.String-">getLogger</a></span>(java.lang.String&nbsp;name)</code>&nbsp;</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>void</code></td>
@ -193,7 +193,7 @@ extends java.lang.Object</pre>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../net/ME1312/SubServers/Host/Executable/SubCreator.html#terminate-java.lang.String-">terminate</a></span>(java.lang.String&nbsp;thread)</code>&nbsp;</td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../net/ME1312/SubServers/Host/Executable/SubCreator.html#terminate-java.lang.String-">terminate</a></span>(java.lang.String&nbsp;name)</code>&nbsp;</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code>void</code></td>
@ -201,7 +201,7 @@ extends java.lang.Object</pre>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../net/ME1312/SubServers/Host/Executable/SubCreator.html#waitFor-java.lang.String-">waitFor</a></span>(java.lang.String&nbsp;thread)</code>&nbsp;</td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../net/ME1312/SubServers/Host/Executable/SubCreator.html#waitFor-java.lang.String-">waitFor</a></span>(java.lang.String&nbsp;name)</code>&nbsp;</td>
</tr>
</table>
<ul class="blockList">
@ -276,7 +276,7 @@ extends java.lang.Object</pre>
<ul class="blockList">
<li class="blockList">
<h4>terminate</h4>
<pre>public&nbsp;void&nbsp;terminate(java.lang.String&nbsp;thread)</pre>
<pre>public&nbsp;void&nbsp;terminate(java.lang.String&nbsp;name)</pre>
</li>
</ul>
<a name="waitFor--">
@ -299,7 +299,7 @@ extends java.lang.Object</pre>
<ul class="blockList">
<li class="blockList">
<h4>waitFor</h4>
<pre>public&nbsp;void&nbsp;waitFor(java.lang.String&nbsp;thread)
<pre>public&nbsp;void&nbsp;waitFor(java.lang.String&nbsp;name)
throws java.lang.InterruptedException</pre>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
@ -322,7 +322,7 @@ extends java.lang.Object</pre>
<ul class="blockListLast">
<li class="blockList">
<h4>getLogger</h4>
<pre>public&nbsp;<a href="../../../../../net/ME1312/SubServers/Host/Executable/SubLogger.html" title="class in net.ME1312.SubServers.Host.Executable">SubLogger</a>&nbsp;getLogger(java.lang.String&nbsp;thread)</pre>
<pre>public&nbsp;<a href="../../../../../net/ME1312/SubServers/Host/Executable/SubLogger.html" title="class in net.ME1312.SubServers.Host.Executable">SubLogger</a>&nbsp;getLogger(java.lang.String&nbsp;name)</pre>
</li>
</ul>
</li>

View File

@ -33,7 +33,7 @@ public class ExternalHost extends Host implements ClientHandler {
private InetAddress address;
private SubCreator creator;
private String directory;
private NamedContainer<Boolean, Client> client;
protected NamedContainer<Boolean, Client> client;
private LinkedList<PacketOut> queue;
private boolean clean;
protected SubPlugin plugin;

View File

@ -122,6 +122,7 @@ public class ExternalSubCreator extends SubCreator {
public void terminate(String name) {
if (this.thread.keySet().contains(name.toLowerCase())) {
host.getSubData().sendPacket(new PacketExCreateServer(name.toLowerCase()));
thread.remove(name.toLowerCase());
}
}
@ -136,7 +137,7 @@ public class ExternalSubCreator extends SubCreator {
@Override
public void waitFor(String name) throws InterruptedException {
while (this.thread.keySet().contains(name.toLowerCase())) {
while (this.thread.keySet().contains(name.toLowerCase()) && host.client.get() != null) {
Thread.sleep(250);
}
}

View File

@ -362,7 +362,7 @@ public class ExternalSubServer extends SubServer {
@Override
public void waitFor() throws InterruptedException {
while (running) {
while (running && host.client.get() != null) {
Thread.sleep(250);
}
}

View File

@ -75,6 +75,8 @@ public class InternalSubCreator extends SubCreator {
} else {
server.setAll(config);
}
} else {
System.out.println(name + "/Creator > Skipping missing template: " + other);
}
}
server.setAll(template.getConfigOptions());
@ -248,9 +250,9 @@ public class InternalSubCreator extends SubCreator {
public void terminate(String name) {
if (this.thread.get(name.toLowerCase()).get().get() != null && this.thread.get(name.toLowerCase()).get().get().isAlive()) {
this.thread.get(name.toLowerCase()).get().get().destroyForcibly();
}
if (this.thread.get(name.toLowerCase()).name() != null && this.thread.get(name.toLowerCase()).name().isAlive()) {
} else if (this.thread.get(name.toLowerCase()).name() != null && this.thread.get(name.toLowerCase()).name().isAlive()) {
this.thread.get(name.toLowerCase()).name().interrupt();
this.thread.remove(name.toLowerCase());
}
}
@ -265,7 +267,7 @@ public class InternalSubCreator extends SubCreator {
@Override
public void waitFor(String name) throws InterruptedException {
while (this.thread.get(name.toLowerCase()) != null && this.thread.get(name.toLowerCase()).name() != null && this.thread.get(name.toLowerCase()).name().isAlive()) {
while (this.thread.keySet().contains(name.toLowerCase()) && this.thread.get(name.toLowerCase()).name() != null && this.thread.get(name.toLowerCase()).name().isAlive()) {
Thread.sleep(250);
}
}

View File

@ -201,6 +201,9 @@ public class SubCreator {
} else {
server.setAll(config);
}
} else {
thread.name().logger.warn.println("Skipping missing template: " + other);
host.subdata.sendPacket(new PacketOutExLogMessage(address, "Skipping missing template: " + other));
}
}
server.setAll(template.getConfigOptions());
@ -337,12 +340,12 @@ public class SubCreator {
}
}
public void terminate(String thread) {
if (this.thread.get(thread).get().get() != null && this.thread.get(thread).get().get().isAlive()) {
this.thread.get(thread).get().get().destroyForcibly();
}
if (this.thread.get(thread).name() != null && this.thread.get(thread).name().isAlive()) {
this.thread.get(thread).name().interrupt();
public void terminate(String name) {
if (this.thread.get(name).get().get() != null && this.thread.get(name).get().get().isAlive()) {
this.thread.get(name).get().get().destroyForcibly();
} else if (this.thread.get(name).name() != null && this.thread.get(name).name().isAlive()) {
this.thread.get(name).name().interrupt();
this.thread.remove(name);
}
}
@ -354,8 +357,8 @@ public class SubCreator {
}
}
public void waitFor(String thread) throws InterruptedException {
while (this.thread.get(thread).name() != null && this.thread.get(thread).name().isAlive()) {
public void waitFor(String name) throws InterruptedException {
while (this.thread.get(name).name() != null && this.thread.get(name).name().isAlive()) {
Thread.sleep(250);
}
}
@ -370,8 +373,8 @@ public class SubCreator {
return loggers;
}
public SubLogger getLogger(String thread) {
return this.thread.get(thread).get().name();
public SubLogger getLogger(String name) {
return this.thread.get(name).get().name();
}
private void generateClient(File dir, ServerType type, String name) throws IOException {

View File

@ -165,9 +165,6 @@ public final class Util {
copyDirectory(srcFile, destFile);
}
} else {
if (to.exists()) {
to.delete();
}
InputStream in = null;
OutputStream out = null;

View File

@ -62,7 +62,7 @@ public class PacketExCreateServer implements PacketIn, PacketOut {
data.getJSONObject("creator").getInt("port"), UUID.fromString(data.getJSONObject("creator").getString("log")), (data.keySet().contains("id"))?data.getString("id"):null);
} catch (Throwable e) {
if (data.keySet().contains("thread")) {
host.creator.terminate(data.getString("thread"));
host.creator.terminate(data.getString("thread").toLowerCase());
} else {
host.creator.terminate();
}