Initialize Client | Java SDK | Teradata AppCenter - Initializing the Teradata AppCenter Client - Teradata AppCenter

Teradata® AppCenter Java SDK User Guide

Product
Teradata AppCenter
Release Number
1.10
Published
July 2020
Language
English (United States)
Last Update
2020-07-13
dita:mapPath
jft1593444327384.ditamap
dita:ditavalPath
ft:empty
dita:id
B035-1118
lifecycle
previous
Product Category
Analytical Ecosystem

Before you can use the Teradata® AppCenter Java SDK, you must initiate the AppCenter client.

  1. Use one of the following methods to initialize the AppCenter client:
    Method Code Example Considerations
    try-with-resources
    try (AppcenterClient client = new DefaultAppcenterClient()) { // your codes that utilize the client}
    Teradata recommends the try-with-resources method to make sure that each resource is closed at the end of the statement.
    try-catch-finally
    AppcenterClient client = null; try { client = new DefaultAppcenterClient(); // your codes that utilize the client } catch (...) {   }finally { client.close(); }
    Make sure you call client.close() in the finally block to ensure resources are closed properly.
    Initialize AppCenter client with AppContext
    AppcenterContext = new AppContext()
       .appcenterBaseUrl("https://appcenter.example.com")
       .system("aster-system")
       .build()
       
    try (AppcenterClient client = new DefaultAppCenterClient(appContext)) {
       // your codes that utilize the client   
    }