public void reconnect() throws MathLinkException { kernelLink.removePacketListener(this); kernelLink.close(); kernelLink = MathLinkFactory.createKernelLink(mlargs); kernelLink.addPacketListener(this); kernelLink.discardAnswer(); }
public Resources(String sessionId, String cacheFolder, String[] mlargs) throws MathLinkException, IOException { this.sessionId = sessionId; this.cacheFolder = cacheFolder; this.mlargs = mlargs; this.resources = new ArrayList<Resources.Resource>(); // Allocate the kernel link and register packet listener kernelLink = MathLinkFactory.createKernelLink(mlargs); kernelLink.addPacketListener(this); kernelLink.discardAnswer(); // Create cache folder File sessionFolderPointer = getSessionFolder(); if (sessionFolderPointer.exists()) delete(sessionFolderPointer); sessionFolderPointer.mkdir(); }