Instance.java
/*
Copyright (C) 2025 Steve Flasby
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package org.flasby.thymeleaf;
import java.io.IOException;
import java.net.Socket;
import lombok.extern.log4j.Log4j2;
@Log4j2
public abstract class Instance implements Lifecycle {
private static int ID=1;
protected final int mInstanceId;
protected final Socket mS;
protected Instance(Socket s){
mS = s;
mInstanceId=ID++;
LOG.debug("Creating server instance {}", mInstanceId);
}
@Override
public void stop() {
try {
mS.close();
LOG.debug("Server instance {} has stopped", mInstanceId);
} catch (IOException e) {
LOG.error("Exception thrown attempting to stop",e);
}
}
@Override
public void start() throws StartFailedException {
}
}