Hi,
I have made an application with a custom made connection class. This class actually doe nothing more than connecting to a particular url through http. The only added functionality is a priority-based vector which stores all the requests for a http connection and sends them according to their priority.
Sometimes it happens I am sending a request with a low priority when all of a sudden a new higher priority request is added to my vector.
is there a way to stop an already ongoing connection so that the new higher priority one can be processed right away ?
I tried with resetting the used connection, and also closing my input and output streams :
andCode:private InputStream in = null; private OutputStream out = null; conn = (HttpConnection)Connector.open(request.getUrl(), Connector.READ_WRITE, true); if (in != null) { try { in.close(); } catch (IOException e) { System.err.print(e.toString()); } } if (out != null) { try { out.close(); } catch (IOException e) { System.err.print(e.toString()); } } closeConnection();
Code:public void closeConnection() { if (conn != null) { try { conn.close(); } catch (IOException e) { System.out.println("Probleem met closen Connectie : " + e.toString()); } } System.gc(); }

Reply With Quote


