activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From toxel <anton.kudi...@gmail.com>
Subject problem with streams
Date Thu, 30 Mar 2006 13:08:41 GMT

I want to send file with size 18M. But I send 10M and program blocking at
method aos.write(buffer,0,read); 
When I restart program not broker, my program blocking after send 184 KB. 
When I restart program and broker I send only 10M again 

I use all standard properties to run activemq and creating connection
factory


					long start = System.currentTimeMillis();
					OutputStream aos = ((ActiveMQConnection)
connection).createOutputStream(dest);
					FileInputStream fis = new FileInputStream(new File("e:/vfp.jar"));
					byte[] buffer = new byte[8 * 1024];
					try {
						long countB = 0;
						int read = fis.read(buffer);
						while (read != -1) {
							aos.write(buffer,0,read);
							read = fis.read(buffer);
							countB += read;
							if (countB % (1024 * 1024) == 0)
								System.out.println("write " + (int)(countB / (1024 * 1024)) + "
mb");
						}
					} catch (IOException e) {
						// обработка исключения
						e.printStackTrace();
					} finally {
						try {
							aos.flush();
							aos.close();
							fis.close();
						} catch (IOException e) {
							// обработка исключения
							e.printStackTrace();
						}
					}
					System.out.println("OK " + (System.currentTimeMillis() - start));
--
View this message in context: http://www.nabble.com/problem-with-streams-t1368296.html#a3669570
Sent from the ActiveMQ - User forum at Nabble.com.


Mime
View raw message