• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

tomdesair / tus-java-server / 27465232708

13 Jun 2026 11:17AM UTC coverage: 92.468% (-2.1%) from 94.575%
27465232708

Pull #80

github

web-flow
Merge 3c0ac21fb into 73dcffedd
Pull Request #80: feat: Add upload lock contention resolution for HEAD requests

603 of 694 branches covered (86.89%)

Branch coverage included in aggregate %.

150 of 197 new or added lines in 7 files covered. (76.14%)

1 existing line in 1 file now uncovered.

1754 of 1855 relevant lines covered (94.56%)

5.88 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/main/java/me/desair/tus/server/upload/UploadLockingService.java
1
package me.desair.tus.server.upload;
2

3
import java.io.IOException;
4
import me.desair.tus.server.exception.TusException;
5

6
/**
7
 * Service interface that can lock a specific upload so that it cannot be modified by other
8
 * requests/threads.
9
 */
10
public interface UploadLockingService {
11

12
  /**
13
   * If the given URI represents a valid upload, lock that upload for processing.
14
   *
15
   * @param requestUri The URI that potentially represents an upload
16
   * @return The lock on the upload, or null if not lock was applied
17
   * @throws TusException If the upload is already locked
18
   */
19
  UploadLock lockUploadByUri(String requestUri) throws TusException, IOException;
20

21
  /**
22
   * Clean up any stale locks that are still present.
23
   *
24
   * @throws IOException When cleaning a stale lock fails
25
   */
26
  void cleanupStaleLocks() throws IOException;
27

28
  /**
29
   * Check if the upload with the given ID is currently locked.
30
   *
31
   * @param id The ID of the upload to check
32
   * @return True if the upload is locked, false otherwise
33
   */
34
  boolean isLocked(UploadId id);
35

36
  /**
37
   * Set an instance if IdFactory to be used for creating identities and extracting them from
38
   * uploadUris.
39
   *
40
   * @param idFactory The {@link UploadIdFactory} to use within this locking service
41
   */
42
  void setIdFactory(UploadIdFactory idFactory);
43

44
  /**
45
   * Register the input stream associated with the active request URI so that it can be interrupted
46
   * if lock contention occurs.
47
   *
48
   * @param requestUri The request URI of the active request
49
   * @param inputStream The input stream of the active request
50
   */
51
  default void registerInputStream(String requestUri, java.io.InputStream inputStream) {
52
    // No-op by default for backwards compatibility
NEW
53
  }
×
54

55
  /**
56
   * Request that the lock for the given request URI be released. This might involve interrupting
57
   * the active request's input stream.
58
   *
59
   * @param requestUri The request URI of the upload lock to release
60
   */
61
  default void requestLockRelease(String requestUri) {
62
    // No-op by default for backwards compatibility
NEW
63
  }
×
64
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc