Comments (3)
Hi, thank you for your comments. This looks to be a valid issue and the team is actively looking into it. We will update this issue when a fix is in place.
from sdk-java.
Hi @georgantasp , the SDK's HttpUtility postData method is written that way for the following reasons:
a. New thread is created for every request execution so that it does not block other requests or become unresponsive.
b. Invoking the shutdown() will only initiate the shutdown process and it will execute all the tasks submitted to it before shutdown has been called. So that race condition will not occur.
c. future.get() has to be called to get the response from the future object and return it to the user immediately.
from sdk-java.
Hi,
I'm pretty far removed from this concern at this point, but if I have time, I'll put together a PR to show you want I mean.
a. Creating new threads is expensive. The point of the executors package is to make it easy for developers to work with thread pools. In this way, a pool of 10 threads (for example) can be created and reused.
b. You're correct. docs
c. You are misunderstanding the point of threads. In a. you are saying that you don't want the calling thread to block, then in c. you are blocking the thread. If you want to be asynchronous, return the future itself and let the user decide if they want the thread to block.
I would encourage you to read "Java Concurrency In Practice" http://jcip.net/ . It's a great resource for learning more.
from sdk-java.
Related Issues (20)
- Environment not set. Set environment using setter or use overloaded method to pass appropriate environment HOT 1
- SDK should not pull non-API logging dependencies
- `Logging Sensitive Data` section is outdated in README.md
- "Defaulting to non-proxy environment" log warning HOT 4
- NPE is thrown when retrieving default customer payment profile
- Highest Version of JDK
- error: package javax.xml.bind.annotation does not exist HOT 4
- How to use sdk-java in android. HOT 2
- Inconsistent types for fields shared between subscription and transaction
- Ampersands in URLs break the Accept Hosted Payment Form HOT 1
- Cannot found any dependency for create Customer Profiles in Android Studio?
- How to Convert to a Gradle Build?
- Junit being pulled in as transitive dependency in compile scope
- CVE-2021-44228: Upgrade log4j to 2.16.0 HOT 1
- Using SDK with scala HOT 1
- Log4j CVE-2021-44832 Vulnerability HOT 1
- Solved
- The credit card number is invalid
- ApplePay attempt: Unable to decrypt data. HOT 2
- Apple Pay: Opaque data can only be used with ECOM market type. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sdk-java.