Changeset 1251
- Timestamp:
- Oct 22, 2010, 8:25:01 AM (13 years ago)
- Location:
- extensions/net.sf.basedb.torrent/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/net.sf.basedb.torrent/trunk/.classpath
r1246 r1251 1 1 <?xml version="1.0" encoding="UTF-8"?> 2 2 <classpath> 3 <classpathentry kind="src" path="src/main"/> 3 4 <classpathentry kind="src" path="src/external/hpbtc"/> 4 <classpathentry kind="src" path="src/main"/>5 5 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> 6 6 <classpathentry kind="lib" path="lib/compile/BASE2Core.jar"/> -
extensions/net.sf.basedb.torrent/trunk/build.xml
r1246 r1251 49 49 50 50 <!-- set up classpath for compiling --> 51 <path id=" classpath">51 <path id="external.classpath"> 52 52 <fileset dir="lib"> 53 53 <include name="**/*.jar" /> 54 54 </fileset> 55 </path> 56 57 <path id="classpath"> 58 <path refid="external.classpath" /> 59 <pathelement location="${build}/external/hpbtc" /> 55 60 </path> 56 61 … … 82 87 prefix="${tar.prefix}" 83 88 preserveLeadingSlashes="true" 84 includes="${jar.name},README,LICENSE*, lib/torrent/*"89 includes="${jar.name},README,LICENSE*,torrent.properties,lib/torrent/*" 85 90 /> 86 91 </tar> … … 140 145 destdir="${build}/external/hpbtc" 141 146 debug="true" 142 classpathref=" classpath"147 classpathref="external.classpath" 143 148 encoding="${javac.encoding}" 144 149 source="${javac.source}" -
extensions/net.sf.basedb.torrent/trunk/src/main/net/sf/basedb/clients/torrent/service/TorrentService.java
r1246 r1251 25 25 26 26 27 import hpbtc.protocol.processor.Client; 28 29 import java.io.IOException; 27 30 import java.util.Properties; 28 31 … … 83 86 private final java.io.File workDir; 84 87 private final int port; 85 private boolean isRunning; 88 private volatile boolean isRunning; 89 private Client btClient; 86 90 87 91 /** … … 110 114 Starts the core service if it is not already running. 111 115 */ 112 public void start()116 public synchronized void start() 113 117 { 114 118 if (isRunning()) return; … … 128 132 } 129 133 134 // Start bittorrent service 135 Client tmpClient = null; 136 try 137 { 138 tmpClient = new Client(); 139 tmpClient.startProtocol(port); 140 } 141 catch (IOException ex) 142 { 143 log.error("Could not start bittorrent client", ex); 144 throw new RuntimeException(ex); 145 } 146 147 btClient = tmpClient; 148 130 149 isRunning = true; 131 150 log.info("Bittorrent Download Service has been started"); … … 136 155 must be created by calling {@link #getInstance(Properties)}. 137 156 */ 138 public void stop()157 public synchronized void stop() 139 158 { 140 159 if (!isRunning()) return; 141 160 log.info("Stopping Bittorrent Download Service"); 142 isRunning = false; 143 service = null; 144 log.info("Bittorrent Download Service has been stopped"); 161 162 try 163 { 164 if (btClient != null) 165 { 166 btClient.stopProtocol(); 167 btClient = null; 168 } 169 } 170 finally 171 { 172 isRunning = false; 173 service = null; 174 log.info("Bittorrent Download Service has been stopped"); 175 } 145 176 } 146 177
Note: See TracChangeset
for help on using the changeset viewer.