1 package org
.spearce
.jgit
.transport
;
4 import java
.io
.IOException
;
5 import java
.io
.InputStream
;
6 import java
.io
.OutputStream
;
7 import java
.io
.PipedInputStream
;
8 import java
.io
.PipedOutputStream
;
10 import org
.spearce
.jgit
.lib
.ProgressMonitor
;
11 import org
.spearce
.jgit
.lib
.Repository
;
14 * This is does-it-all fetch implementation.
16 public class FullFetchClient
extends FetchClient
{
18 private PipedInputStream pi
= new PipedInputStream();
19 Throwable
[] threadError
= new Throwable
[1];
21 private String remote
;
25 public void run(final ProgressMonitor monitor
) throws IOException
{
27 indexThread
= new Thread() {
32 pack
= new IndexPack(repository
, pi
, new File(new File(repository
.getObjectsDirectory(), "pack"), "packtmp_pack"+System
.currentTimeMillis()));
34 pack
.renameAndOpenPack();
35 } catch (Throwable e
) {
37 fetchThread
.interrupt();
42 fetchThread
= Thread
.currentThread();
47 updateRemoteRefs(remote
);
48 } catch (InterruptedException e
) {
49 if (threadError
[0] != null)
50 if (threadError
[0] instanceof IOException
)
51 throw (IOException
)threadError
[0];
52 throw new Error(threadError
[0]);
54 if (indexThread
.isAlive()) {
55 indexThread
.interrupt();
58 } catch (InterruptedException e
) {
66 * Construct a {@link FullFetchClient}
70 * @param initialCommand
75 public FullFetchClient(Repository repository
, String remoteName
, String initialCommand
,
76 OutputStream toServer
, InputStream fromServer
) throws IOException
{
77 super(repository
, initialCommand
, toServer
, fromServer
, null);
79 os
= new PipedOutputStream(pi
);