private void executeThreadWithTimeout() { try { int timeout = 180; ExecutorService executor = Executors.newSingleThreadExecutor(); executor.invokeAll(Arrays.asList(new Task()), timeout, TimeUnit.SECONDS); executor.shutdown(); } catch (Exception e) { } } private class Task implements Callable{ public Integer call() throws Exception { try { // Task go here Thread.sleep(60 * 60 * 1000); } catch (Exception e) { } return 0; } }
Thursday 8 December 2011
Execute thread from Java with timeout
In order to execute java thread with timeout, please use following snippet:
Wednesday 7 December 2011
Execute command line process from Java with timeout
In order to execute command line process from Java with timeout, please use following snippet:
public static void executeCommand(String command, long timeoutInSeconds) throws Exception { ExecutorService service = Executors.newSingleThreadExecutor(); Process process = Runtime.getRuntime().exec(command); try { Callablecall = new CallableProcess(process); Future future = service.submit(call); int exitValue = future.get(timeoutInSeconds, TimeUnit.SECONDS); if (exitValue != 0) { throw new Exception("Process did not exit correctly"); } } catch (ExecutionException e) { throw new Exception("Process failed to execute", e); } catch (TimeoutException e) { process.destroy(); throw new Exception("Process timed out", e); } finally { service.shutdown(); } } private static class CallableProcess implements Callable { private Process p; public CallableProcess(Process process) { p = process; } public Integer call() throws Exception { return p.waitFor(); } }
Sunday 13 November 2011
Tuesday 8 November 2011
Salesforce DEV 401 Preparation - Day 8
1. App Setup -> Customize
1.5. Leads
1.5.1. Fields
1.5.2. Validation Rules
1.5.3. Triggers
1.5.4. Page Layouts
1.5.5. Field Sets
1.5.6. Search Layouts
1.5.7. Assignment Rules
1.5.8. Settings
1.5.9. Buttons and Links
1.5.10. Lead Processes
1.5.11. Record Types
1.5.12. Web-to-Lead
1.5.13. Auto-Response Rules
1.5. Leads
1.5.1. Fields
1.5.2. Validation Rules
1.5.3. Triggers
1.5.4. Page Layouts
1.5.5. Field Sets
1.5.6. Search Layouts
1.5.7. Assignment Rules
1.5.8. Settings
1.5.9. Buttons and Links
1.5.10. Lead Processes
1.5.11. Record Types
1.5.12. Web-to-Lead
1.5.13. Auto-Response Rules
Monday 7 November 2011
Salesforce DEV 401 Preparation - Day 7
1. App Setup -> Customize
1.4. Campaigns
1.4.1. Fields
1.4.2. Validation Rules
1.4.3. Triggers
1.4.4. Page Layouts
1.4.5. Field Sets
1.4.6. Search Layouts
1.4.7. Buttons and Links
1.4.8. Record Types
1.4.9. Campaign Influence
1.4.10. Campaign Members
1.4.10.1. Fields
1.4.10.2. Validation Rules
1.4.10.3. Triggers
1.4.10.4. Page Layouts
1.4.10.5. Field Sets
1.4.10.6. Buttons and Links
1.4.10.7. Record Types
1.4. Campaigns
1.4.1. Fields
Can only change help text of standard campaign fields. Can create custom campaign fields.
Marketing user license is required to create new campaign.
Can add validation rules for campaign object.
Can add trigger for campaign object.
1.4.5. Field Sets
1.4.6. Search Layouts
1.4.7. Buttons and Links
Can override campaign standard buttons with visualforce pages. Campaign custom buttons and links include 3 kinds: + Detail Page Link + Detail Page Button + List Button
1.4.9. Campaign Influence
1.4.10. Campaign Members
1.4.10.1. Fields
1.4.10.2. Validation Rules
1.4.10.3. Triggers
1.4.10.4. Page Layouts
1.4.10.5. Field Sets
1.4.10.6. Buttons and Links
1.4.10.7. Record Types
Sunday 6 November 2011
Salesforce DEV 401 Preparation - Day 6
1. App Setup -> Customize
1.1. Tab Names and Labels
1.1.1. Rename Tabs and Labels
1.1.2. Help Settings
1.2. Home
1.2.1. Home Page Components
1.2.2. Home Page Layouts
1.2.3. Custom Links
1.3. Activities
1.3.1. Task Fields
1.3.2. Task Validation Rules
1.3.3. Task Triggers
1.3.4. Task Buttons and Links
1.3.5. Task Page Layouts
1.3.6. Task Field Sets
1.3.7. Task Record Types
1.3.8. Event Fields
Similar to task fields
1.3.9. Event Validation Rules
Similar to task validation rules
1.3.10. Event Triggers
Similar to task triggers
1.3.11. Event Buttons and Links
Similar to task buttons and links
1.3.12. Event Page Layouts
Similar to task page layouts
1.3.13. Event Field Sets
Similar to task field sets
1.3.14. Event Record Types
Similar to task record types
1.3.15. Activity Custom Fields
1.3.16. Activity Search Layouts
1.3.17. Activity Buttons
1.3.18. Public Calendars and Resources
1.3.19. Activity Settings
1.3.20. Cloud Scheduler
1.1. Tab Names and Labels
1.1.1. Rename Tabs and Labels
Can change singular label, plural label and 'starts with vowel sound' of standard objects. Can change record name, singular label, plural label and 'starts with vowel sound' of custom objects. Record name changed by 'App Setup -> Customize' is different from one changed by 'App Setup -> Create -> Objects'. Record name changed by 'App Setup -> Customize' is used in list views, edit/view forms.
Can change URL of the context-specific Help links on any salesforce.com page. (One for all).
1.2.1. Home Page Components
Standard components on home page is not editable except 'Messages & Alerts', 'Custom Links'. 'Custom links' standard component contains up to 15 bookmarks. There are 3 kinds of custom component which can be added to home page: + Links + Image/Logo + HTML Area 'Links' custom component contains custom links which is created by 'App Setup -> Customize -> Home -> Custom Links'. 'Image/Logo' custom component contains multiple images and text. Images are inserted from document folders. 'Links', 'Image/Logo' custom components are always in Narrow (Left) Column. 'HTML Area' can be in Narrow (Left) Column or Wide (Right) Column. Can not change column kind of 'HTML Area' custom component.
Can assign home page layout to profile. 'Home Page Default' layout is not editable.
Link behaviors include: + Display in new window + Display in existing window with sidebar + Display in existing window without sidebar + Display in existing window without sidebar or header + Execute JavaScript
1.3.1. Task Fields
Can only change help text of task fields. Task custom fields are created by using "Activity Custom Fields". Task custom field are same as event custom field.
Can add validation rules for task object.
Can add triggers for task object.
Can override task standard buttons with visualforce pages. Task custom buttons and links include 3 kinds: + Detail Page Link + Detail Page Button + List Button
1.3.6. Task Field Sets
1.3.7. Task Record Types
1.3.8. Event Fields
Similar to task fields
1.3.9. Event Validation Rules
Similar to task validation rules
1.3.10. Event Triggers
Similar to task triggers
1.3.11. Event Buttons and Links
Similar to task buttons and links
1.3.12. Event Page Layouts
Similar to task page layouts
1.3.13. Event Field Sets
Similar to task field sets
1.3.14. Event Record Types
Similar to task record types
1.3.15. Activity Custom Fields
Custom field is created for both task and event.
1.3.17. Activity Buttons
Can override standard button with visualforce page. There is no activity custom button.
Access levels of sharing include: + Hide Details - Users can only see availability. + Hide Details and Add Events - Users can see availability and add events. + Show Details - Users can view the details of events, but they cannot add events or edit existing events. + Show Details and Add Events - Users can view the details of events and add events, but they cannot edit existing events. + Full Access - Users can view the details of events, add events, and edit existing events. In order to add event to resource calendar, create event on public calendar or user calendar, choose 'Add Invitees' in 'Invite Others' section, search within 'Resources' and insert selected resources.
+ Enable Group Tasks: + Enable Sidebar Calendar Shortcut: show link to calendar on sidebar + Enable Creation of Recurring Events: show 'Recurrence' section when create new event + Enable Creation of Recurring Tasks: show 'Recurrence' section when create new task + Enable Activity Reminders: show 'Reminder' section when create new task or event. + Enable Email Tracking: + Show Event Details on Multi-User Calendar View: + Enable Multiday Events: + Show Requested Meetings in the Calendar Section on the Home Tab: + Show Custom Logo in Meeting Requests:
Add or remove 'New Meeting Request' button to or from the Open Activities related list on contact, lead, and person account page layouts.
Tuesday 1 November 2011
Salesforce DEV 401 Preparation - Day 3
1. Income statement, Statement of cash flows
Create Income statement, Statement of cash flows
Subscribe to:
Posts (Atom)