RSS

(root)/fsp/javalib : 164

hsn at sendmail
2009-10-01 13:46:58
Revision ID: hsn@sendmail.cz-20091001134658-kmfnd20kj5unfaaj
FSPOutputStream class now using writerLock

collapse all collapse all

added added

removed removed

10
        change was needed because proper URLConnection support requires infinite
10
        change was needed because proper URLConnection support requires infinite
11
        timeout support from transport.
11
        timeout support from transport.
12
      Added (un)lockWriter to FSPsession.
12
      Added (un)lockWriter to FSPsession.
 
 
13
      FSPOutputStream uses blocking Writer locks
13
1.0rc7
14
1.0rc7
14
      Sourcefiles moved into net/fsp directory to match their package name
15
      Sourcefiles moved into net/fsp directory to match their package name
15
        and moved into src folder for easier compiling in Eclipse and Maven2
16
        and moved into src folder for easier compiling in Eclipse and Maven2
38
         * always uploads to temporary file no checking if client can really
38
         * always uploads to temporary file no checking if client can really
39
         * create/overwrite desired file is performed until end of upload.
39
         * create/overwrite desired file is performed until end of upload.
40
         * Custom timestamp on uploaded file is not supported by this class.
40
         * Custom timestamp on uploaded file is not supported by this class.
 
 
41
         * This constructor will block if there is already another active writing
 
 
42
         * stream assigned to FSPsession.
41
         *
43
         *
42
         * @param session FSPsession to target server
44
         * @param session FSPsession to target server
43
         * @param filename filename
45
         * @param filename filename
50
                this.fname=FSPutil.stringToASCIIZ(filename);
52
                this.fname=FSPutil.stringToASCIIZ(filename);
51
                this.bufpos = 0;
53
                this.bufpos = 0;
52
                this.pos = 0;
54
                this.pos = 0;
 
 
55
                session.lockWriter(this, true);
53
        }
56
        }
54
 
57
 
55
        /**
58
        /**
111
         * @see FSPutil#upload(FSPsession, String, java.io.InputStream, long)
114
         * @see FSPutil#upload(FSPsession, String, java.io.InputStream, long)
112
         */
115
         */
113
    public void close() throws IOException {
116
    public void close() throws IOException {
114
        flush();
 
 
115
        FSPpacket pkt;
117
        FSPpacket pkt;
116
        pkt = ses.interact(FSPpacket.CC_INSTALL, 0, fname, 0, fname.length, null, 0, 0);
118
        try {
117
        pkt.expect(FSPpacket.CC_INSTALL);
119
                flush();
118
        /* delete buffer so we cant write to closed file */
120
                pkt = ses.interact(FSPpacket.CC_INSTALL, 0, fname, 0, fname.length, null, 0, 0);
119
        fname = buf = null;
121
                pkt.expect(FSPpacket.CC_INSTALL);
 
 
122
        }
 
 
123
        finally {
 
 
124
                /* delete buffer so we cant write to closed file */
 
 
125
                ses.unlockWriter(this);
 
 
126
                fname = buf = null;
 
 
127
                ses = null;
 
 
128
        }
120
    }
129
    }
121
 
130
 
122
    /**
131
    /**

Loggerhead is a web-based interface for Bazaar branches