0
我有一個REST Web服務:在服務或servlet中重新使用com.google.gson.Gson對象?
@Path("/tranreq")
public class TranscriptRequesterResource {
private static final Gson GSON = new Gson();
@GET
@Produces(MediaType.APPLICATION_JSON)
public String getTranscriptRequests() {
// use GSON here
}
}
這是安全的,使GSON對象的靜態最終定並重新使用它的多線程請求大家?
很酷。感謝您及時的回覆。 –
我一直在很多線程中使用它作爲靜態共享變量一段時間...並沒有問題。看起來不錯。所以我標記你的答案是正確的。 –