~ubuntu-branches/ubuntu/vivid/httpcomponents-core/vivid

« back to all changes in this revision

Viewing changes to httpcore-nio/src/main/java/org/apache/http/nio/protocol/BasicAsyncRequestProducer.java

  • Committer: Package Import Robot
  • Author(s): Emmanuel Bourg
  • Date: 2014-10-25 23:01:10 UTC
  • mfrom: (1.2.5)
  • Revision ID: package-import@ubuntu.com-20141025230110-lhr341pbqk6l2loc
Tags: 4.3.3-1
* New upstream release
* Ignore the apache-rat-plugin
* Standards-Version updated to 3.9.6 (no changes)

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
import org.apache.http.HttpEntityEnclosingRequest;
33
33
import org.apache.http.HttpHost;
34
34
import org.apache.http.HttpRequest;
35
 
import org.apache.http.annotation.ThreadSafe;
36
35
import org.apache.http.nio.ContentEncoder;
37
36
import org.apache.http.nio.IOControl;
38
37
import org.apache.http.nio.entity.EntityAsyncContentProducer;
50
49
 *
51
50
 * @since 4.2
52
51
 */
53
 
@ThreadSafe
54
52
public class BasicAsyncRequestProducer implements HttpAsyncRequestProducer {
55
53
 
56
54
    private final HttpHost target;
110
108
        }
111
109
    }
112
110
 
113
 
    public synchronized HttpRequest generateRequest() {
 
111
    public HttpRequest generateRequest() {
114
112
        return this.request;
115
113
    }
116
114
 
118
116
        return this.target;
119
117
    }
120
118
 
121
 
    public synchronized void produceContent(
 
119
    public void produceContent(
122
120
            final ContentEncoder encoder, final IOControl ioctrl) throws IOException {
123
121
        if (this.producer != null) {
124
122
            this.producer.produceContent(encoder, ioctrl);
134
132
    public void failed(final Exception ex) {
135
133
    }
136
134
 
137
 
    public synchronized boolean isRepeatable() {
 
135
    public boolean isRepeatable() {
138
136
        return this.producer == null || this.producer.isRepeatable();
139
137
    }
140
138
 
141
 
    public synchronized void resetRequest() throws IOException {
142
 
        if (this.producer != null) {
143
 
            this.producer.close();
144
 
        }
145
 
    }
146
 
 
147
 
    public synchronized void close() throws IOException {
148
 
        if (this.producer != null) {
149
 
            this.producer.close();
150
 
        }
 
139
    public void resetRequest() throws IOException {
 
140
        if (this.producer != null) {
 
141
            this.producer.close();
 
142
        }
 
143
    }
 
144
 
 
145
    public void close() throws IOException {
 
146
        if (this.producer != null) {
 
147
            this.producer.close();
 
148
        }
 
149
    }
 
150
 
 
151
    @Override
 
152
    public String toString() {
 
153
        final StringBuilder sb = new StringBuilder();
 
154
        sb.append(this.target);
 
155
        sb.append(' ');
 
156
        sb.append(this.request);
 
157
        if (this.producer != null) {
 
158
            sb.append(' ');
 
159
            sb.append(this.producer);
 
160
        }
 
161
        return sb.toString();
151
162
    }
152
163
 
153
164
}