Lucio Lelii 2018-04-06 13:14:37 +00:00
parent cd43b8f199
commit 8aa6871b5d
2 changed files with 8 additions and 4 deletions

View File

@ -90,6 +90,7 @@ public class QueryCache<T> implements Serializable{
fos = new FileOutputStream(file); fos = new FileOutputStream(file);
deflater = new DeflaterOutputStream(fos, new Deflater(Deflater.BEST_COMPRESSION, true)); deflater = new DeflaterOutputStream(fos, new Deflater(Deflater.BEST_COMPRESSION, true));
writer = new ObjectOutputStream(deflater); writer = new ObjectOutputStream(deflater);
logger.debug("file created {}",file.getAbsolutePath());
} catch (Exception e) { } catch (Exception e) {
if (file!=null) if (file!=null)
file.delete(); file.delete();
@ -117,6 +118,7 @@ public class QueryCache<T> implements Serializable{
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void getAll(ObjectWriter<T> writer){ public void getAll(ObjectWriter<T> writer){
logger.debug("file to open is {} ",file==null?null:file.getAbsolutePath());
try(FileInputStream fis = new FileInputStream(file); InflaterInputStream iis = new InflaterInputStream(fis, new Inflater(true)); ObjectInputStream ois =new ObjectInputStream(iis) ){ try(FileInputStream fis = new FileInputStream(file); InflaterInputStream iis = new InflaterInputStream(fis, new Inflater(true)); ObjectInputStream ois =new ObjectInputStream(iis) ){
String obj = null; String obj = null;
while (( obj = (String)ois.readObject())!=null && writer.isAlive()) while (( obj = (String)ois.readObject())!=null && writer.isAlive())

View File

@ -59,7 +59,6 @@ public class Executor {
public String getResultLink(@PathParam("jobKey") String jobKey) throws InvalidIdentifierException { public String getResultLink(@PathParam("jobKey") String jobKey) throws InvalidIdentifierException {
String node; String node;
String jobId; String jobId;
try{ try{
node = extractNode(jobKey); node = extractNode(jobKey);
jobId = extractId(jobKey); jobId = extractId(jobKey);
@ -216,22 +215,25 @@ public class Executor {
} }
private static String extractNode(String key) throws IdNotValidException{ private static String extractNode(String key) throws IdNotValidException{
String[] splitted = key.split("\\|\\|"); logger.trace("id arrived is {}", key );
String[] splitted = key.split("_");
if (splitted.length==2) if (splitted.length==2)
return splitted[0]; return splitted[0];
else throw new IdNotValidException(); else throw new IdNotValidException();
} }
private static String extractId(String key) throws IdNotValidException{ private static String extractId(String key) throws IdNotValidException{
String[] splitted = key.split("\\|\\|"); logger.trace("id arrived is {}", key );
String[] splitted = key.split("_");
if (splitted.length==2) if (splitted.length==2)
return splitted[1]; return splitted[1];
else throw new IdNotValidException(); else throw new IdNotValidException();
} }
private String createKey(String id){ private String createKey(String id){
logger.trace("id arrived is {}", id );
String node = cxt.container().profile(HostingNode.class).id(); String node = cxt.container().profile(HostingNode.class).id();
return node+"||"+id; return node+"_"+id;
} }
/* /*
private Executor remoteJobCall(String riId) throws InvalidIdentifierException{ private Executor remoteJobCall(String riId) throws InvalidIdentifierException{