(merge avec precedent) Intégration de PandacubeWeb dans le code PHP actuel + Corrections bugs
This commit is contained in:
parent
5f10f1d55f
commit
0df60d9d01
@ -89,11 +89,11 @@ public final class ORM {
|
|||||||
if (tables.contains(elemClass)) return;
|
if (tables.contains(elemClass)) return;
|
||||||
try {
|
try {
|
||||||
tables.add(elemClass);
|
tables.add(elemClass);
|
||||||
Log.info("Start initializing SQL table "+elemClass.getName());
|
//Log.info("Start Init SQL table "+elemClass.getSimpleName());
|
||||||
E instance = elemClass.newInstance();
|
E instance = elemClass.newInstance();
|
||||||
String tableName = instance.tableName();
|
String tableName = instance.tableName();
|
||||||
if (!tableExist(tableName)) createTable(instance);
|
if (!tableExist(tableName)) createTable(instance);
|
||||||
Log.info("End of initializing SQL table "+elemClass.getName());
|
//Log.info("End init SQL table "+elemClass.getSimpleName());
|
||||||
} catch (Exception|ExceptionInInitializerError e) {
|
} catch (Exception|ExceptionInInitializerError e) {
|
||||||
throw new ORMInitTableException(elemClass, e);
|
throw new ORMInitTableException(elemClass, e);
|
||||||
}
|
}
|
||||||
@ -287,8 +287,7 @@ public final class ORM {
|
|||||||
* for(SQLPlayer p : players) {
|
* for(SQLPlayer p : players) {
|
||||||
* System.out.println(p.get(SQLPlayer.playerDisplayName));
|
* System.out.println(p.get(SQLPlayer.playerDisplayName));
|
||||||
* }
|
* }
|
||||||
* // TODO LIST
|
* // TODO mise à jour relative d'un champ (incrément / décrément)
|
||||||
* - Gérer mise à jour relative d'un champ (incrément / décrément)
|
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -25,10 +25,11 @@ public class ByteBuffer implements Cloneable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void askForBufferExtension(int needed) {
|
private void askForBufferExtension(int needed) {
|
||||||
if (buff.remaining() >= needed) return;
|
while (buff.remaining() < needed) {
|
||||||
java.nio.ByteBuffer newBuff = java.nio.ByteBuffer.wrap(Arrays.copyOf(buff.array(), buff.array().length * 2));
|
java.nio.ByteBuffer newBuff = java.nio.ByteBuffer.wrap(Arrays.copyOf(buff.array(), buff.array().length * 2));
|
||||||
newBuff.position(buff.position());
|
newBuff.position(buff.position());
|
||||||
buff = newBuff;
|
buff = newBuff;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -21,8 +21,7 @@ public class PacketServerException extends PacketServer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deserializeFromByteBuffer(ByteBuffer buffer) {
|
public void deserializeFromByteBuffer(ByteBuffer buffer) {
|
||||||
// TODO Auto-generated method stub
|
exception = buffer.getString();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ import java.net.InetSocketAddress;
|
|||||||
import java.net.ServerSocket;
|
import java.net.ServerSocket;
|
||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
import java.net.SocketAddress;
|
import java.net.SocketAddress;
|
||||||
|
import java.net.SocketException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.BlockingQueue;
|
import java.util.concurrent.BlockingQueue;
|
||||||
@ -80,8 +81,10 @@ public class TCPServer extends Thread implements Closeable {
|
|||||||
Log.getLogger().log(Level.SEVERE, "Connexion impossible avec " + socketClient.getInetAddress());
|
Log.getLogger().log(Level.SEVERE, "Connexion impossible avec " + socketClient.getInetAddress());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch(SocketException e) {
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.getLogger().log(Level.WARNING, "Plus aucune connexion ne peux être acceptée", e);
|
Log.warning("Plus aucune connexion ne peux être acceptée", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,6 +139,7 @@ public class TCPServer extends Thread implements Closeable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} catch(SocketException e) {
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.severe("Closing connection " + address, e);
|
Log.severe("Closing connection " + address, e);
|
||||||
}
|
}
|
||||||
@ -242,16 +246,17 @@ public class TCPServer extends Thread implements Closeable {
|
|||||||
public void close() {
|
public void close() {
|
||||||
try {
|
try {
|
||||||
if (isClosed.get()) return;
|
if (isClosed.get()) return;
|
||||||
|
isClosed.set(true);
|
||||||
|
|
||||||
clients.forEach(el -> el.close());
|
clients.forEach(el -> el.close());
|
||||||
|
|
||||||
socket.close();
|
|
||||||
isClosed.set(true);
|
|
||||||
try {
|
try {
|
||||||
listener.onSocketClose(this);
|
listener.onSocketClose(this);
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
Log.severe("Exception while calling TCPServerListener.onSocketClose()", e);
|
Log.severe("Exception while calling TCPServerListener.onSocketClose()", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
socket.close();
|
||||||
} catch (IOException e) {}
|
} catch (IOException e) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user